I'm writing a script that pulls XML data from wowarmory.com, using PHP 5 and cURL:
$url = "http://www.wowarmory.com";
$userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$url);
$str = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
$str .= "Accept-Language: en-us,en;q=0.5\r\n";
$str .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n";
$str .= "Keep-Alive: 300\r\n";
$str .= "Connection: keep-alive\r\n";
curl_setopt($ch, CURLOPT_HTTPHEADER, array($str));
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 3000);
$xml = curl_exec($ch);
When I run this from my hosted web server, I get the XML response as expected. But when running from my localhost web server, I get nothing.
I can get any other website via cURL from localhost ( yahoo.com, even worldofwarcraft.com ), but not wowarmory.com. So I know cURL is functioning properly.
I'm using the following versions of PHP and cURL:
Hosted Server:
- php 5.2.6
- cURL libcurl/7.16.1 OpenSSL/0.9.7e zlib/1.2.3
Localhost:
- php 5.2.6
- cURL libcurl/7.16.0 OpenSSL/0.9.8i zlib/1.2.3
Any ideas?
EDIT: Localhost is running Windows XP SP3. I can access wowarmory.com through a web browser. Tracert starts timing out at hop 13 ( from my location, obviously ):
13 458 ms 529 ms 549 ms 0.so-6-0-0.BR1.LAX15.ALTER.NET [152.63.116.21]
14 476 ms 510 ms 488 ms 192.205.34.29
15 257 ms 279 ms 261 ms cr1.la2ca.ip.att.net [12.122.128.14]
16 242 ms 259 ms 249 ms gar5.la2ca.ip.att.net [12.122.128.25]
17 252 ms * 1691 ms 12.122.255.74
18 * 2361 ms 634 ms mdf001c7613r0003-gig-10-1.lax1.attens.net [12.129.193.242]
19 * * * Request timed out.
I'm not familiar with tcptraceroute, unfortunately.
The windows binary version of curl doesn't return anything for http://www.wowarmory.com/ but does for http://www.yahoo.com/
I don't have wget available.
EDIT 2: I can access my localhosted website just fine. It's just the response from curl I don't receive. I'm running a pretty much default XAMPP install ( apache 2 on windows xp ). All of this works fine.