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?
Best regards Markus
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
Am 17.02.2010 21:11, schrieb Conrad Irwin:
On 02/17/2010 08:10 PM, Markus Möller wrote:
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
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Hello Conrad,
thank you very much for your quick and helpful answer. After adding the user agent everything works fine.
BR Markus
mediawiki-api@lists.wikimedia.org