These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

eve api xml, php and me - can anyone help?

Author
Lamthara Lachesis
Emporio Amarr
#1 - 2013-10-19 13:43:29 UTC
i'm a noob in php so i ask here hoping someone will be able to help me.

I'm trying to create a php page that will show the name of my account... once i've mastered this maybe i'll be able to show something more useful like the market orders, transactions,

I've written this:

=================================================

$url = "xml->https://api.eveonline.com/account/characters.xml.aspx?keyID=keyID&vCode=vCode";

$xml = simplexml_load_file($url);

foreach($xml->row as $row)
{
echo $row["name"]
}

=================================================

but it writes... nothing. Where is my mistake?
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#2 - 2013-10-19 15:45:22 UTC
The data structure is a little more complicated than that. var_dump() is your friend in this situation. (oh, and you have a rogue xml-> at the front of your url)


foreach ($xml->result->rowset->row as $row){
echo $row{'name'};
echo "\n";
}

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Talos Katuma
Helion Production Labs
Independent Operators Consortium
#3 - 2013-10-19 19:04:20 UTC
I would also recommend to use one of the api libraries around, I found PhealNG quite nice:
https://github.com/3rdpartyeve/phealng

Those make it easier to interact with the api and take care of caching results and dealing with error codes.
Lamthara Lachesis
Emporio Amarr
#4 - 2013-10-19 20:43:26 UTC
thanks to both of you..

I've understood both of my mistakes. The first one was in the coding.. the second one was i used a free web hosting that probably blocked the simplexml_load_file

But now it works on the localhost and i know how to make a few things i have in mind.

Thanks so much!
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#5 - 2013-10-19 21:45:18 UTC
Talos Katuma wrote:
I would also recommend to use one of the api libraries around, I found PhealNG quite nice:
https://github.com/3rdpartyeve/phealng

Those make it easier to interact with the api and take care of caching results and dealing with error codes.



Talos is entirely right, of course.

Using the libraries means you don't have to think so much about edge conditions, as they've been thought about for you.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter