cURL Returning No Value For Valid Armory

85 Worgen Death Knight
12970
Hey all.

My armory tool for my guild site was working fine up until a day ago. Now, it is broken and I cannot seem to figure out why.

I am using this string as the test URL: http://us.battle.net/api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements

Here is the code for the PHP for the cURL:

$this->URL = "http://us.battle.net/api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements";

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $this->URL );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$curl_return = curl_exec( $ch );
curl_close( $ch );


$curl_return has no value if I do a print_r().

Any idea what could be wrong with the cURL all of a sudden?

Thanks.
Edited by Slades on 12/8/2011 2:40 PM PST
Reply Quote
MVP
90 Tauren Druid
8240
Hi, Slades,

I've verified that your code works, here: https://gist.github.com/b4f32c610472353488df (I've prettied up the JSON output).

What is the status code you're getting from the API? Using PHP's cURL functions, you can get this with:

$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $http_status;


after the call to `curl_exec` but before the call to `curl_close`.
________________________________________________
MVP, Web and API
Libraries for the Community Platform API: http://us.battle.net/wow/en/forum/topic/2369882588
Edited by Cyaga on 12/8/2011 3:45 PM PST
Reply Quote
85 Worgen Death Knight
12970
Echoing back with '0' for the $http_status value.
Reply Quote
85 Worgen Death Knight
12970
I implemented curl_error method and it returned "couldn't connect to host".

Any ideas?
Reply Quote
85 Worgen Death Knight
12970
This is a big issue for me and I cannot seem to figure it out.

Any ideas on how to fix this or other ways to troubleshoot the issue?
Reply Quote
Web & Mobile Team
Do all requests fail or is that the only one?
Reply Quote
85 Worgen Death Knight
12970
All requests fail.
Reply Quote
85 Blood Elf Paladin
13140
Do you have shell access to the box? "Couldn't connect to host" implies that whatever server is executing the code cannot connect.

Assuming you are on a unix box and can run curl from the command line, you can test using this command:

Matts-17:tmp matt$ curl -v -o output.json http://us.battle.net/api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements
* About to connect() to us.battle.net port 80 (#0)
* Trying 12.129.242.40... % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
* Connected to us.battle.net (12.129.242.40) port 80 (#0)
> GET /api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-apple-darwin10.4.0) libcurl/7.21.0 OpenSSL/1.0.0a zlib/1.2.5 libidn/1.19
> Host: us.battle.net
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 09 Dec 2011 20:09:48 GMT
< Server: Apache
< X-Frame-Options: SAMEORIGIN
< Last-Modified: Thu, 08 Dec 2011 23:29:40 GMT
< Content-Language: en-US
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: application/json;charset=utf-8
<
{ [data not shown]
100 172k 0 172k 0 0 138k 0 --:--:-- 0:00:01 --:--:-- 226k* Connection #0 to host us.battle.net left intact

* Closing connection #0
Matts-17:tmp matt$


So try using that curl command

( curl -v -o output.json http://us.battle.net/api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements )

And pasting the output here; it should help diagnose the issue.
Reply Quote
85 Worgen Death Knight
12970
Here is the response I got back from the command:

root@ve:/# curl -v -o output.json http://us.battle.net/api/wow/character/Frostmane/Slades?fields=stats,talents,professions,titles,items,reputation,mounts,achievements
* About to connect() to us.battle.net port 80 (#0)
* Trying 12.129.242.40... Connection timed out
* couldn't connect to host
* Closing connection #0

curl: (7) couldn't connect to host

Reply Quote
55 Gnome Death Knight
0
I know the API has a transaction limit. I don't know what happens when you exceed that limit but I imagine blocking the connection entirely could be one response.

It could also just be that your host no longer routes to battle.net, which could be a temporary problem. I noticed your root, did you try resetting your networking?

/etc/init.d/network restart
Reply Quote
85 Worgen Death Knight
12970
I cannot imagine that I have hit a transaction limit. Even then, the transaction limit is per day and this issue has been going on for several days.

I am going to speak with my host today and see what the heck is going on.

Also, for the network reset, it states that no such file/directory exists.
Reply Quote
85 Blood Elf Paladin
13140
* Trying 12.129.242.40... Connection timed out


Well, it resolved the IP address, which means the name service is working.

It is definitely not a transaction limit issue; Blizzard doesn't (afaict) refuse connections for that; their server throws 500 errors at you. You're not even getting far enough to make the request.

Try doing:

curl -v -o google.txt google.com

Paste that. That will tell us if your outbound connections are battle.net-specific or a general problem.
Reply Quote
85 Blood Elf Paladin
13140
12/09/2011 01:04 PMPosted by Clorak
/etc/init.d/network restart


This is distribution-specific. "service network restart" will be more cross-distribution compatible. Although realistically unless his setup is EXTREMELY unusual there's no way this can help. If he is ON his server, the default route is working, and that's all 99.99% of web hosting boxes will have; there may be a routing problem but it will be further upstream.

Reply Quote
85 Worgen Death Knight
12970
It seems to be Battle.net specific.

Here is the output from the Google hit:

root@ve:~# curl -v -o google.txt google.com
* About to connect() to google.com port 80 (#0)
* Trying 74.125.115.99... connected
* Connected to google.com (74.125.115.99) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: google.com
> Accept: */*
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Fri, 09 Dec 2011 22:02:30 GMT
< Expires: Sun, 08 Jan 2012 22:02:30 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
<
{ [data not shown]
109 219 109 219 0 0 2568 0 --:--:-- --:--:-- --:--:-- 14600* Connection #0 to host google.com left intact

* Closing connection #0
Reply Quote
85 Blood Elf Paladin
13140
Yep. Battle.net-specific. So there's a pretty large list of things it could theoretically be. I might be able to suggest what's more/less likely if you describe your environment. (ie, is this a dedicated server? A virtual machine somewhere? A VPS?)

Anyhow, among things it could be:

- A routing problem from your host to battle.net
- A routing problem from battle.net to your host
(routing on the Internet is basically only done by destination, so it may be that you can send them packets, but they aren't routed back)
- A firewall on your system or somewhere on your host's network
- Blizzard is blocking you for some reason (seems really unlikely, but possible)

Hmm. It might be worth doing this:

[matt@manticore ~]$ traceroute us.battle.net
traceroute to us.battle.net (12.129.242.40), 30 hops max, 40 byte packets
1 n.n.n.n (n.n.n.n) 0.659 ms 0.532 ms 0.578 ms (this line modified for privacy)
2 0.ae2.tsr1.lga5.us.voxel.net (208.122.44.209) 0.247 ms 0.271 ms 0.356 ms
3 telia-pni.lga5.us.voxel.net (213.248.73.17) 0.268 ms 0.246 ms 0.217 ms
4 nyk-b5-link.telia.net (213.155.130.32) 0.243 ms nyk-b5-link.telia.net (213.155.131.254) 10.204 ms nyk-b5-link.telia.net (213.155.131.252) 10.161 ms
5 192.205.36.109 (192.205.36.109) 0.658 ms 0.658 ms 0.584 ms
6 cr1.n54ny.ip.att.net (12.122.81.106) 71.215 ms 72.218 ms 72.641 ms
7 cr2.cgcil.ip.att.net (12.122.1.2) 71.264 ms 71.213 ms 71.187 ms
8 cr1.cgcil.ip.att.net (12.122.2.53) 70.713 ms 70.601 ms 70.583 ms
9 cr2.dvmco.ip.att.net (12.122.31.85) 70.002 ms 69.983 ms 70.003 ms
10 cr1.slkut.ip.att.net (12.122.30.25) 71.534 ms 71.459 ms 71.482 ms
11 cr2.la2ca.ip.att.net (12.122.30.30) 73.238 ms 73.228 ms 73.191 ms
12 gar29.la2ca.ip.att.net (12.122.129.241) 67.254 ms 67.283 ms 67.369 ms
13 12-122-254-238.attens.net (12.122.254.238) 68.075 ms 12-122-254-234.attens.net (12.122.254.234) 68.138 ms 68.028 ms
14 mdf001c7613r0003-gig-12-1.lax1.attens.net (12.129.193.254) 68.068 ms mdf001c7613r0004-gig-10-1.lax1.attens.net (12.129.193.250) 68.068 ms 68.096 ms
15 12.129.199.254 (12.129.199.254) 68.233 ms !X


You could try and/or paste here a traceroute to try to determine if there is a routing problem "along the way".

Note: if you do paste a traceroute, you will be revealing some information about where your host is on the Internet. It may or may not be enough to uniquely identify it, but if you're paranoid about keeping it secret, be aware a lot of information can be gathered from such a step. That said, it's also the best thing to look at diagnostically.

If you have tech support from your host, then I'd suggest just doing this:

[matt@manticore ~]$ telnet us.battle.net 80
Trying 12.129.242.40...
Connected to us.battle.net.
Escape character is '^]'.


Yours will time out. You can simply copy/paste the timeout into a ticket to them and say "My box is unable to connect to us.battle.net, which I need access to for a web API. Other people report no such problems, so I suspect the problem may be originating on your network. Please let me know if you see this problem from other parts of your network, or if you know a reason this connection would fail when it succeeds for people coming from other locations."
Edited by Tashur on 12/9/2011 2:32 PM PST
Reply Quote
85 Worgen Death Knight
12970
Hey Tashur. Thanks for all of your help first off.

This is a dedicated virtual server with mediatemple.net. I have never had any problems with them for the past 5 years up until three days ago when this problem hit with my armory utlity.

I went ahead and opened a ticket with my host, but still went ahead with the traceroute as well. Here is the output from the traceroute:

root@ve:~# traceroute us.battle.net
traceroute to us.battle.net (12.129.242.40), 30 hops max, 60 byte packets
1 vzd037.mediatemple.net (205.186.160.3) 0.023 ms 0.012 ms 0.012 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *


It went back to the root after this so I could enter initial commands.
Reply Quote
85 Worgen Death Knight
12970
Fixed out the problem. The IP was blocked at my host's top-most network layer. It is all rectified now.

Thank you all for your help!
Reply Quote
MVP
90 Tauren Druid
8240
Glad you got it worked out, Slades, and thanks to all the community members who helped!
________________________________________________
MVP, Web and API
Libraries for the Community Platform API: http://us.battle.net/wow/en/forum/topic/2369882588
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]