How to disguise your PHP script as a browser?

后端 未结 3 1832
野性不改
野性不改 2020-12-30 04:41

We\'ve been using information from a site for a while now (something that the site allows if you mention the source and we do) and we\'ve been copying the information by han

相关标签:
3条回答
  • 2020-12-30 05:29

    I had to lose 'Accept-Encoding: gzip,deflate', from the $header to get it to work properly on my godaddy website.

    0 讨论(0)
  • 2020-12-30 05:40

    Try escaping your URL, it works for me that way.

    http://mediaforest.ro/weeklycharts/viewchart.aspx?r=WeeklyChartRadioLocal&y=2010&w=46%2008-11-10%2014-11-10
    
    0 讨论(0)
  • 2020-12-30 05:44

    Use curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');

    You can replace the useragent with another one of course.

    However, "Bad Request" is most likely NOT related to a missing/bad useragent. It sounds like the webserver itself doesn't like your request.. not the application behind the requested URI.

    0 讨论(0)
提交回复
热议问题