I am trying to send a POST request to Meta using my account... but it's just not working very well. Using netcat, I was able to post one comment, but I have had no luck getting it to work with a PHP script.
I used a TCP monitor to capture the packets going back and forth between my browser and the server and managed to figure out some of it.
I am hoping someone on the team can help me here. Here is the POST request I'm sending:
POST /posts/51812/comments HTTP/1.1 Host: meta.stackoverflow.com User-Agent: Mozilla/5.0 Accept: text/html, */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: http://meta.stackexchange.com/questions/51812/ Cookie: usr=*********; somusr=********* Pragma: no-cache Cache-Control: no-cache Content-Length: 87 comment=This+comment+was+posted+from+someplace...&fkey=********
As you can see, a normal request. I have a few questions though:
- What is the
fkeyparameter for? Where does it come from? What I have been doing thus far is fetching the page I want to post the comment on and using a RegEx to dig up the value.
- Why does the server return the following and what does it mean?
HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=utf-8 Location: /error?aspxerrorpath=/posts/51812/comments Server: Microsoft-IIS/7.5 Date: Mon, 26 Jul 2010 01:44:07 GMT Content-Length: 171 ...
Any help or pointers would be appreciated.