PHP Curl Simulation answer, always 400 error

Source: Internet
Author: User
Tags urlencode
PHP Curl PHP Curl

I want to simulate this site's answer: http://zsjs.kaiwind.com/kf/html/index.html
He is landing on the above page, then to the new page to answer questions, the answer is all finished and actually, allow the submission.
He is the AJAX submission, all JS authentication passed, back to the background to send AJAX requests, complete the page.

He sent the data is not complex, but in the simulation of his data sent, but always error, the following posted code and error prompts, hope that the great God to save.
Code:
Curl Request section:
   
Executive section:
  UrlEncode ($phone), ' area ' =>urlencode ($area)), $GLOBALS [' cookie_file '] = $cookie _jar;require_once ('./ Functions.php '); $url = ' http://zsjs.kaiwind.com/kf/html/index.html ';//Vget ($url);//exit (); $browsers = Array ("ACC Ept "=" text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 "," accept-encoding "=" gzip ", Deflat E "," accept-language "=" zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 "," cache-control "=" max-age=0 "," Connection "= > "Keep-alive", "Content-type" and "application/x-www-form-urlencoded",//"Cookie" = "cnzzdata199524=cnzz_ Eid%3d713570903-1381646309-http%253a%252f%252fzsjs.kaiwind.com%26ntime%3d1381738758%26cnzz_a%3d0%26retime% 3d1381738758499%26sin%3d%26ltime%3d1381738758499%26rtime%3d1 "," Host "=" zsjs.kaiwind.com "," user-agent "and" = " mozilla/5.0 (Windows NT 6.1; rv:24.0) gecko/20100101 firefox/24.0 "); $url = ' http://zsjs.kaiwind.com/kf/kfcheck.php ';d UMP (Vpost ($url, $data); exit (); $url = ' http://zsjs.kaiwind.com/kf/kfsub.php ';d UMP (Vpost ($url, $data));? >


Results returned by the page:

String (90) "

Request


Your Browser sent an invalid request.

"


Reply to discussion (solution)

Cookie on the last line,?

curl_setopt ($curl, curlopt_useragent, $_server[' http_user_agent '); Simulating the browser used by the user

Let's try to comment this out.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.