Failing API Calls

This code is timing out, worked fine the other day. Not sure if its my site host or if I am being throttled? Is there a way to tell?


<?php
$htmlScrap = file_get_contents('http://us.battle.net/api/wow/character/aerie-peak/Zhue?fields=stats');
echo htmlScrap;
?>


Results:

Warning: file_get_contents(http://us.battle.net/api/wow/character/aerie-peak/Zhue?fields=stats): failed to open stream: Connection timed out in ********/wowapi.php on line 2 NULL
Reply Quote
90 Dwarf Mage
10875
According to the API docs, you should receive a 500 response code with a JSON response body containing the "If at first you don't succeed, blow it up again. (too many requests)" reason when you're being throttled.

http://blizzard.github.com/api-wow-docs/#features/error-handling

This indicates that it's probably your host, but I can't say for sure what your application's current status with the API is.
Reply Quote
Yeah I created a support ticket with my host about this issue.

I should have checked github, appreciate the response.

Currently in development mode. Well under 3k requests per day for anonymous use. Which made me curious how I could be throttled but... as you said probably the host.
Reply Quote
Web & Mobile Team
Yeah, if you are getting timeouts than the issue is not anything to do with our API code. Either you're being blocked by our server admins (VERY unlikely, for all of the sites I've checked about this I've NEVER seen it be an issue), or your ISP or their ISP is blocking the calls for some reason. Often dev work can trigger their (horrible) filters.
Edited by Peratryn on 3/27/2013 2:00 PM PDT
Reply Quote
90 Draenei Hunter
7700
If your getting timeouts today it might be because of the massive ddos going on.

http://www.nytimes.com/2013/03/27/technology/internet/online-dispute-becomes-internet-snarling-attack.html?_r=0
Reply Quote
90 Night Elf Hunter
11760
i would also try usuing a curl call some times file_get_contents just failes for me but curl get results
Reply Quote
27 Undead Warrior
4840
By the way i am having the same problem with outland in Europe, my host is wiredtree. I try to port to CURL because i am using file get contents too...
Reply Quote
90 Dwarf Hunter
19355
Try:
<?php echo ini_get('allow_url_fopen'); ?>

If it writes out '0', then your webhost has disabled the ability to use remote files in fopen() (and many other file-related functions, including file_get_contents), possibly as some form of security measure. Using curl is a good alternative for handling HTTP requests, as it does error handling much better by default.
Edited by Yuyn on 3/27/2013 3:18 PM PDT
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]