You can use the following functions:
Function posttohost ($ url, $ data ){
$ Url = parse_url ($ url );
If (! $ Url) return "couldnt 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 HTTP/1.0", $ url [path], $ url [query]? "? ":" ", $ Url [query]);
Fputs ($ fp, "Host: $ url [host]");
Fputs ($ fp, "Content-type: application/x-www-form-urlencoded ");
Fputs ($ fp, "Content-length:". strlen ($ encoded )."");
Fputs ($ fp, "Connection: close ");
Fputs ($ fp, "$ encoded ");
$ Line = fgets ($ fp, 1024 );
If (! Eregi ("^ HTTP/1 .. 200", $ line) return;
$ Results = ""; $ inheader = 1;
While (! Feof ($ fp )){
$ Line = fgets ($ fp, 1024 );
If ($ inheader & ($ line = "" | $ line = "")){
$ 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 );
?>