Jump to content

Php and XML - not showing data


tjverge

Recommended Posts

The following code should output 1743425391, but it does not show anything

<?php
$xml_feed_url = 'http://api.eve-online.com/eve/CharacterID.xml.aspx?names=TX1';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_feed_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);


$xmlr = new SimpleXMLElement($xml);

$charid = $xmlr->result->characterID;

echo $charid;
?>

 

The xml is:

<eveapi version="2">
<currentTime>2011-02-01 05:22:38</currentTime>
−
<result>
−
<rowset name="characters" key="characterID" columns="name,characterID">
<row name="TX1" characterID="1743425391"/>
</rowset>
</result>
<cachedUntil>2011-03-01 05:22:38</cachedUntil>
</eveapi>

 

Any ideas where I went wrong?

Link to comment
Share on other sites

not sure if it helps but when I use print_r($xmlr); it returns

SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2 ) [currentTime] => 2011-02-01 05:57:30 [result] => SimpleXMLElement Object ( [rowset] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => characters [key] => characterID [columns] => name,characterID ) [row] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => TX1 [characterID] => 1743425391 ) ) ) ) [cachedUntil] => 2011-03-01 05:57:30 ) 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.