Note that there are some explanatory texts on larger screens.

plurals
  1. POHTTP Header POST Request with Curl
    text
    copied!<p>I grabbed the following Post request with Fiddler, i only masked the URL because i dont want to make an advertisement</p> <pre><code>POST http://xyz.com/dialogs/track HTTP/1.1 Host: www.xyz.com User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0 Accept: application/json, text/javascript, */*; q=0.01 Accept-Language: de Accept-Encoding: gzip, deflate DNT: 1 Content-Type: application/json; charset=utf-8 X-CSRFToken: uuihXszJrkrXwnCkLKKDNQ8BrPRDqXvU X-Requested-With: XMLHttpRequest Referer: http://www.xyz.com/referer/ Content-Length: 2 Cookie: csrftoken=uuihXszJrkrXwnCkLKKDNQ8BrPRDqXvU Connection: keep-alive Pragma: no-cache Cache-Control: no-cache {} </code></pre> <p>I need a Tutorial (Link would be usefull) to "fake" this Request with Curl, i found some stuff on Google but nothing is working an i receive errors.</p> <p>-EDIT-</p> <pre><code>$headers = array( 'POST http://www.example.com/dialogs/track HTTP/1.1', 'Host: www.example.com', 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0', 'Accept: application/json, text/javascript, */*; q=0.01', 'Accept-Language: de', 'Accept-Encoding: gzip, deflate', 'DNT: 1', 'Content-Type: application/json; charset=utf-8', 'X-CSRFToken: uuihXszJrkrXwnCkLKKDNQ8BrPRDqXvU', 'X-Requested-With: XMLHttpRequest', 'Referer: http://www.example.com', 'Content-Length: 2', 'Cookie: __cfduid=d0db16cb5c4c58db770a1374f09a61d7d1375100590810; csrftoken=uuihXszJrkrXwnCkLKKDNQ8BrPRDqXvU; __utma=1.2111538523.1375265099.1375427020.1375431064.5; __utmz=1.1375348556.2.2.utmcsr=example.de|utmccn=(referral)|utmcmd=referral|utmcct=/game/index.php; __gads=ID=88f0a0a8b0698e1e:T=1375265099:S=ALNI_MYX8OxkwPxXQd7VY4qDImLK7fq_yQ; __utmb=1.4.9.1375431089319; __utmc=1', 'Connection: keep-alive', 'Pragma: no-cache', 'Cache-Control: no-cache', '', '{}' ); //set POST variables $url = 'http://www.example.com/dialogs/track'; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_HTTPHEADER, $headers); //execute post $result = curl_exec($ch); //close connection if (curl_error($ch)) { print "Error: " . curl_error($ch); } else { var_dump($data); curl_close($ch); } </code></pre> <p>Error Message</p> <blockquote> <p>Error: Recv failure: Connection reset by peer</p> </blockquote> <p>-EDIT 2-</p> <p>I played a little bit around and now the connection is working, but it seems that the CSRF Token is not submittet correctly i recieve an error!</p> <blockquote> <p>Forbidden (403)</p> <p>CSRF verification failed. Request aborted.</p> </blockquote> <p>Is their a solution?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload