<? Php
// Simple post method
// Version 1.0 by Andrus (andrus@vnet.ee)
// Disclaimer:
// Everyone can change or use this code however and wherever they want ;)
// NB! For posting to Microsoft platform webservers you may need to change newlines "" ""
// Microsoft always breaks standards...
// Send out "browser" headers
Function send_headers ($ fp ){
Fputs ($ fp, "Accept :*/*");
Fputs ($ fp, "Accept-Language: en ");
Fputs ($ fp, "Connection: Keep-Alive ");
Fputs ($ fp, "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98 )");
}
// Post data and return reply
Function post_data ($ host, $ url, $ data ){
$ Fp = @ fsockopen ($ host, 80, $ errno, $ errstr, 120 );
$ Ret = "";
If (strncasecmp ($ url, "http: //", 7) = 0) $ url = substr ($ url, 7 );
$ P = strpos ($ url ,'/');
If (empty ($ p )){
$ Req = "/";
} Else {
$ Req = substr ($ url, $ p );
}
If ($ fp ){
Fputs ($ fp, "POST $ req HTTP/1.0 ");
Send_headers ($ fp );