|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-04 08:07 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
<?php $fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n"); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ?> This will work but if fputs( ) is this fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com"); ie no "\r\n\r\n", then fgets( ) will block and the code will timeout. On the server side, the "GET / ..." is read, but will block on the send( ).