You can use the following functions:
Function posttohost ($ URL, $ data ){
$ Url = parse_url ($ URL );
If (! $ URL) Return "couldn't parse URL ";
If (! Isset ($ URL ['Port']) {$ URL ['Port'] = "";}
If (! Isset ($ URL ['query']) {$ URL ['query'] = "";}
$ Encoded = "";
While (List ($ K, $ v) = each ($ data )){
$ Encoded. = ($ encoded? "&":"");
$ Encoded. = rawurlencode ($ K). "=". rawurlencode ($ V );
}
$ Fp = fsockopen ($ URL ['host'], $ URL ['Port']? $ URL ['Port']: 80 );
If (! $ FP) Return "failed to open socket to $ URL [host]";
Fputs ($ FP, sprintf ("post % S % s HTTP/1.0/N", $ URL ['path'], $ URL ['query']? "? ":" ", $ URL ['query']);
Fputs ($ FP, "Host: $ URL [host]/n ");
Fputs ($ FP, "Content-Type: Application/X-WWW-form-urlencoded/N ");
Fputs ($ FP, "Content-Length:". strlen ($ encoded). "/N ");
Fputs ($ FP, "connection: Close/n ");
Fputs ($ FP, "$ encoded/N ");
$ Line = fgets ($ FP, 1024 );
If (! Eregi ("^ HTTP/1/.. 200", $ line) return;
$ Results = ""; $ inheader = 1;
While (! Feof ($ FP )){
$ Line = fgets ($ FP, 1024 );
If ($ inheader & ($ line = "/N" | $ line = "/R/N ")){
$ Inheader = 0;
}
Elseif (! $ Inheader ){
$ Results. = $ line;
}
}
Fclose ($ FP );
Return $ results;
}
?>
You can also
$ Url = "www.mysite.com/test.php ";
$ CH = curl_init ();
Curl_setopt ($ ch, curlopt_url, "https: // $ URL ");
Curl_setopt ($ ch, curlopt_post, 1 );
Curl_setopt ($ ch, curlopt_postfields, "data1 = blah & data2 = blah ");
Curl_exec ($ ch );
Curl_close ($ ch );
?>