MJ.
MJ.

Reputation: 149

PHP cURL not returning XML

I'm trying to get character data from www.wowarmory.com using PHP and cURL.

The code I have so far is:

...        
$browser = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";

$url = "http://www.wowarmory.com/character-sheet.xml?r=Ner'zhul&n=Visar";

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, $browser);

$result = curl_exec($ch);

The var_dump($result) is false, and if I try to parse the $result into an XML the $result is blank.

What I'm trying to get is a characters XML file. (http://www.wowarmory.com/character-sheet.xml?r=Ner%27zhul&n=Visar), but without the XSL attached. Then parse this, and extract info from the file, but I just need to get the file first.

Upvotes: 0

Views: 2355

Answers (1)

drudru
drudru

Reputation: 5023

Call:

echo curl_error($ch);

after the curl_exec to see what the error is since curl_exec is returning false, which indicates an error.

Upvotes: 1

Related Questions