On 02/17/2010 08:10 PM, Markus Möller wrote:
Hello,
when I try to send an api request I will receive a 403 forbidden error. I call the following URL using the PHP file_get_contents method: http://de.wikipedia.org/w/api.php?action=opensearch&search=baby&form...
When I call exactly the same URL in a browser everything ist fine. I'm a little bit confused. Are there any blocked IP addresses?
If it works in the browser, your IP is not blocked. The chances are that your user agent is not set.
Just add:
ini_set( 'user_agent', 'Markus Möller's super cool bot' );
Before the file_get_contents()
Wikimedia forbids blank user agents to avoid some misbehaved robots. Sorry for the inconvenience.
Conrad