|
From: Roger Y. <ry...@gm...> - 2012-07-10 01:46:33
|
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
|