fsockopen Fread and fget issue

From: Date: Thu, 05 Jun 2008 19:57:27 +0000
Subject: fsockopen Fread and fget issue
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-275083@lists.php.net to get a copy of this message
When I do the following it grabs the response (And using a packet sniffer I can see the server responds quick). If I only call fread one time it will read and return the page to the server. If I read a second batch after the eof it hangs for 30 seconds. All I want to do is send a raw POST and get the response that can be up to 500K or as little as 450 bytes of XML. PHP Version 5.2.1 System Linux lamp 2.6.20-16-server #2 SMP Tue Feb 12 05:48:21 UTC 2008 i686 Build Date Nov 28 2007 23:00:22 Server API Apache 2.0 Handler $fp = fsockopen($host, $port, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { fwrite($fp, SOAP_Call("Email_AddWithFields" ,$Parms)); while (!feof($fp)) { $x .= fread($fp, 16000); } fclose($fp); }

« previous php.general (#275083) next »