|
From: Roy R. <tch...@gm...> - 2012-07-11 11:20:17
|
The bug you posted: https://bugs.php.net/bug.php?id=51330 Has an answer that says it's related to the server's keep-alive designation. Perhaps a library that simple test browser uses respects keep-alive. If you can modify that header, that may solve the timeout. --- Cell: 585 519 7658 ><> On Jul 10, 2012, at 10:39 PM, Roger Yarrow <ry...@gm...> wrote: > Additionally, this works. The secret again is that content-length. How > can I make SimpleBrowser complete its transaction once that length is > received rather than hanging? > > $headers = get_headers($url, 1); > $content_length = $headers["Content-Length"]; > $content = file_get_contents($url, NULL, NULL, NULL, $content_length); > echo $content; > die(); > > On Mon, Jul 9, 2012 at 9:46 PM, Roger Yarrow <ry...@gm...> wrote: > >> Hello, >> >> I am attempting to communicate with a web-based RFID door controller. All >> operations via PHP to the unit's IP address hang, but it works in a browser. >> >> When I use SimpleBrowser, it will hang until ConnectionTimeout and then >> work. So it takes 15 seconds (default timeout) to get a response: >> >> echo $browser->get('192.168.1.240'); >> >> This gives me a response back in 1 second. >> >> $browser->setConnectionTimeout(1); >> echo $browser->get('192.168.1.240'); >> >> I am getting all the contents of the page returned, but SimpleBrowser >> isn't happy. It thinks everything is failing and I can't proceed: >> >> getURL() = http://192.168.1.240/ACT_ID_1 >> getHeaders() = POST /ACT_ID_1 HTTP/1.0 >> Host: 192.168.1.240 >> Connection: close >> Content-Length: 43 >> Content-Type: application/x-www-form-urlencoded >> username=abc&pwd=123&logId=20090416 >> getTransportError() = Nothing fetched >> getResponseCode() = 0 >> >> So, the timeout gets triggered, and I get a response finally but it assume >> failure. >> >> I determined it was content-length related due to this post I found at >> https://bugs.php.net/bug.php?id=51330 >> >> This operation hangs forever: >> >> $content = file_get_contents('http://192.168.1.240'); >> >> But this one returns immediately because I give it a maximum length of >> content to expect: >> >> $content = file_get_contents('http://192.168.1.240/', NULL, NULL, 0, >> 1000); >> >> Is there a way/fix to set SimpleBrowser to respond/react appropriately and >> not hang/timeout? Like a header or something I can set? >> >> Thanks, >> Roger >> > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Simpletest-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpletest-support |