note 7355 modified in fsockopen by ronabop

From: Date: Sat, 26 Aug 2000 04:44:56 +0000
Subject: note 7355 modified in fsockopen by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-3290@lists.php.net to get a copy of this message
Some servers do not close connection by default, so if you send just fput($fp,"HEAD / HTTP/1.1\r\nHOST: dummy\r\n\r\n"); and trying to read response by while(!feof($fp)) { $response .= fgets($fp,128); } fclose($fp); } it hangs (checked for IIS/4.0, for Apache - above code is OK) use fputs($fp,"HEAD $FilePath HTTP/1.1\r\n"); fputs($fp,"HOST: dummy\r\n"); fputs($fp,"Connection: close\r\n\r\n"); http://www.php.net/manual/function.fsockopen.php

« previous php.notes (#3290) next »