note 20363 added to function.fsockopen

From: Date: Mon, 01 Apr 2002 12:59:17 +0000
Subject: note 20363 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-28460@lists.php.net to get a copy of this message
I'v seen how does a GET request works [sample 1] and a POST request works like that : <?php $fp = fsockopen ("192.168.0.3", 80); if ($fp) { fputs ($fp, " POST /localhost/test/p.php HTTP/1.1 Host: 192.168.0.3 Content-Length: 7 Content-Type: application/x-www-form-urlencoded Connection: Close a=1&b=2 "); while (!feof($fp)) echo fgets ($fp,128); fclose ($fp); } ?> Host: must be the same as the server else the POST isn't accepted Content-lenght: is th lenght of the line of the values [a=1&b=2] a=1&b=2 values are writted like a GET but without ? at beginning... you can use POST and GET together with this line : POST /localhost/test/p.php?val=3 HTTP/1.1 Have fun ! it's just 4 fun, dont try to hack ! Special thanks to GNOX : http://come.to/gnox -- http://www.php.net/manual/en/function.fsockopen.php http://master.php.net/manage/user-notes.php?action=edit+20363 http://master.php.net/manage/user-notes.php?action=delete+20363 http://master.php.net/manage/user-notes.php?action=reject+20363

« previous php.notes (#28460) next »