Fsockopen spoofs the post and get methods. If you are looking for PHP processing code that spoofs the post and get methods, this is good.
<? PHP
// Fsocket simulate post submission
$ Purl = "http: // localhost/netphp/test2.php? UU = rrrrrrrrrrrr ";
Print_r (parse_url ($ URL ));
Sock_post ($ Purl, "UU = 55555555555555555 ");
// Fsocket simulate get submission
Function sock_get ($ URL, $ query)
{
$ Info = parse_url ($ URL );
$ Fp = fsockopen ($ info ["host"], 80, $ errno, $ errstr, 3 );
$ Head = "get". $ info ['path']. "? ". $ Info [" query "]." HTTP/1.0rn ";
$ Head. = "Host:". $ info ['host']. "RN ";
$ Head. = "RN ";
$ Write = fputs ($ FP, $ head );
While (! Feof ($ FP ))
{
$ Line = fread ($ FP, 4096 );
Echo $ line;
}
}
Sock_post ($ Purl, "UU = rrrrrrrrrrrrrr ");
Function sock_post ($ URL, $ query)
{
$ Info = parse_url ($ URL );
$ Fp = fsockopen ($ info ["host"], 80, $ errno, $ errstr, 3 );
$ Head = "Post". $ info ['path']. "? ". $ Info [" query "]." HTTP/1.0rn ";
$ Head. = "Host:". $ info ['host']. "RN ";
$ Head. = "Referer: http: //". $ info ['host']. $ info ['path']. "RN ";
$ Head. = "Content-Type: Application/X-WWW-form-urlencodedrn ";
$ Head. = "Content-Length:". strlen (TRIM ($ query). "RN ";
$ Head. = "RN ";
$ Head. = trim ($ query );
$ Write = fputs ($ FP, $ head );
While (! Feof ($ FP ))
{
$ Line = fread ($ FP, 4096 );
Echo $ line;
}
}
?>