ID: 37517 Comment by: brynb at omg-games dot com Reported By: gzaboy at hotmai dot com Status: Feedback Bug Type: *Network Functions Operating System: windows 2003 server PHP Version: 5.1.4 New Comment:
I'm having the same problem, even after installing 5.2. $serverip = "192.168.0.12"; $fp = fsockopen($serverip, 80, $errno, $errstr, 3); if(!$fp) { print "CONNECTION FAILED"; return 0; } fputs($fp,$httpheader); //get the response $result=""; while (!feof($fp)) $result .= fread($fp,32000); fclose($fp); print $result; so, the function either times out (30 second script execution limit) or $result ends up as a blank string. the initial fsockopen call should fail, because i'm contacting an ip at which there's no http server (in fact, it's a 2nd computer sitting RIGHT NEXT TO ME and i'm switching apache on and off to test this thing). the $serverip variable IS an ipv4 address. i'm basically sending an http request through tcp (i've even tried prefixing "tcp://" to the ip, with no variance in result). note that all of this code works perfectly when the apache server is enabled... it's just when it's disabled that i get these results. Previous Comments: ------------------------------------------------------------------------ [2006-05-26 18:40:06] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip I've done a basic test with latest php 5.2 cvs and it works fine. You need to provide more info about your program, like is $server an IP (v4 or v6) or a hostname, the protocol used, etc.. ------------------------------------------------------------------------ [2006-05-19 11:14:24] gzaboy at hotmai dot com Description: ------------ the timeout option of fsockopen seems to be ignored below code,if remote host has no responed,the error information:"Error" would not display: Reproduce code: --------------- $h = fsockopen($server,80,$errno,$errstr,5); if($h){ fwrite($h,$post); while(!feof($h)){ $str .= fgets($h,127); } fclose($h); return $str; }else{ die("Error"); } Expected result: ---------------- die("Error"); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37517&edit=1