How to disguise your PHP script as a browser?

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.


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