note 20363 deleted from function.fsockopen by dave
| From: | dave@php.net | Date: | Fri, 16 Jun 2006 13:29:53 +0000 |
| Subject: | note 20363 deleted from function.fsockopen by dave | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114294@lists.php.net to get a copy of this message | ||
Note Submitter: info at free-dev dot com
----
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