-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Ken, This code chunk should do the trick..... - -- php code -- $data ="insert=data&location=here"; /* This would be the data that needs to be posted to the site - urlencode it */ /* Headers for http transaction....replace /folder/pages.ext */ $header = "POST /folder/pages.ext HTTP/1.1\r\n". "Accept-Language: en-us\r\n". /* Additional info for the receiving server.....optional */ "Content-Length: ".strlen($data)."\r\n". /* This line is *very* important - length of posted data */ "Content-Type: application/x-www-form-urlencoded\r\n". /* Type of content the server can expect from us */ "User-Agent: YourCustomUser-Agent (compatible; Linux 2.4; RedHat 7.2;)\r\n". /* optional */ "Host: host.com\r\n". /* the "host" of the site you are sending the posted data to.....*/ "Cookie: cookie-name=cookie-val\r\n\r\n". /* We can even send cookies!!!! optional......remove and add an extra \r\n to the above line */ "$data"; /* this is where the data is sent....no need to change this line. */ $fp = fsockopen ("host.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, $header); while (!feof($fp)) { echo fgets ($fp,128); /* Data returned from server.....use as you like */ } fclose ($fp); } - -- End php code --
On Friday 16 August 2002 08:02 pm, Ken Meyer wrote: > I am trying to write a script that will read a page from another website. > So long at the page is accessed via a "GET", this is no problem; I just > need to open the page using fopen, readfile or file_get_contents. The > problem is that I need to access a page that requires a "POST". Any > suggestions as to how I could do this? > > Thanks. > > Ken - -- ~Paul Nicholson Design Specialist @ WebPower Design "The web....the way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9XbT7DyXNIUN3+UQRApOmAJ4zYjKW+WzoxuNmx8j2S87StyHT2ACdH+AQ iDOX+hvxCFyFPb19knyBp8s= =TvmX -----END PGP SIGNATURE----- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php