Blech fsockopen() 🙂
Well, I am able to forge up a HTTP request and can grab the cookies I need. Now the posting.
I want to post the cookies + some form data to a server, reading the results. I assume I will need to use fsockopen() again. Are there any APIs which can help me in this??
I wish you could choose a socket to use stuff like Header(), etc in, to be nice in your generation of a HTTP request...
Anyhoo, How best can I generate a POST form with cookies? I think I have it (using code from this forum) with:
$header="POST /cgi-bin/form.cgi HTTP/1.0\r\n";
$header.="Content-type: application/x-www-form-urlencoded\r\n";
$header.=$Cookie["TOKENX"]."\r\n";
$header.=$Cookie["IDY"]."\r\n";
$header.="Referer: http://x.foobar.com/index.html\r\n";
$header.="Link: http://x.foobar.com/index.html\r\n";
$header.="Content-length: ".strlen($request)."\r\n";
$header.="Connection: close\r\n\r\n";
Where $Cookie[] contains the cookie strings snagged from a previous http request and the POST data ($request) given after the $header is pushed.
I think, though, the server CGI looks for some normal HTML headers and complains. Does the above look right? Is there a list of core 1.0/1.1 headers?
-Scott