Pages: [1] :: one page |
Author |
Thread Statistics | Show CCP posts - 0 post(s) |

Moodle
|
Posted - 2007.12.11 16:44:00 -
[1]
Hi Yall,
Does anyone have any simple examples of connecting to and pulling data from the eve api system?
php or asp would be good..
Cheers
Moodle.
|

Clogs'R'us
Caldari Deep Core Mining Inc.
|
Posted - 2007.12.11 17:15:00 -
[2]
I am at work right now, but will post some examples tonight.
|

Moodle
|
Posted - 2007.12.11 17:36:00 -
[3]
Sweet, thanks...
Look forward to it... simpler the better !!!
Cheers
Moodle
|

Salvis Tallan
Gallente The Shadow Order SMASH Alliance
|
Posted - 2007.12.11 18:32:00 -
[4]
I dont know php, so I dont know simple, but does: http://wiki.eve-dev.net/API_PHP_Class help? ------
|

Johnathan Roark
Caldari Quantum Industries Interstellar Alcohol Conglomerate
|
Posted - 2007.12.11 19:12:00 -
[5]
This is what I use, will only work with php 5 though.
//Build Post Array $auth = array( 'userID' => $userid, 'apiKey' => $apikey );
//Begins connecting to eve api
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($auth));
curl_exec ($ch);
//Initializes the XML Parser $xml = new SimpleXMLElement(curl_exec($ch)); //Closes the eveapi connection curl_close($ch);
//Parse the xml file foreach ($xml->xpath('//error') as $error) { echo "Error: ".$error['code']."<br>\n"; echo $error; }
foreach ($xml->xpath('//row') as $row) { //xml parsing goes here }
Corporation Management Improvement |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.12.11 20:56:00 -
[6]
My API Lib
You can have a look at the 'class.api.php' file _ Planet Sight Wallpaper - EvE map |

Clogs'R'us
Caldari Deep Core Mining Inc.
|
Posted - 2007.12.12 06:28:00 -
[7]
Super Simple example
Quote: <?php
// Populate the following with your API Data $apiKey = "PUT THE API KEY HERE"; $userID = "PUT YOUR USER ID HERE"; $characterID = "PUT YOUR Character ID Here";
// Create the URL to the EVE API $eveAPI = "http://api.eve-online.com/char/CharacterSheet.xml.aspx?userID=".$userID."&apiKey=".$apiKey."&characterID=".$characterID;
// Get the xml data $xml = simplexml_load_file($eveAPI);
echo "Charactor Name = ".$xml->result->name."<br />"; echo "Charactor Race = ".$xml->result->race."<br />"; echo "Charactor Gender = ".$xml->result->gender."<br />"; echo "Corporation Name = ".$xml->result->corporationName."<br />";
// Loop Through Skills foreach ($xml->result->rowset[0] as &$value) { echo "Skill Number:".$value['typeID']." -- Skill Points: ".$value['skillpoints']." -- Level: ".$value['level']."<br />"; };
?>
That will (With out error handling at all, or any consideration to cache or how often it gets the data) will get the xml data from the EVE api, display some basic information and loop through the skills
|

Moodle
|
Posted - 2007.12.12 09:03:00 -
[8]
Thanks loads people, the last script appears simple enough, it pulls the basic info down ok but i get the following error on the skills section..
Fatal error: An iterator cannot be used with foreach by reference in D:\xampp\htdocs\Eve\test.php on line 23
line 23 being : foreach ($xml->result->rowset[0] as &$value) {
i am running PHP 5.2.3 could this be an issue ?
Thanks Again.
M
|

Clogs'R'us
Caldari Deep Core Mining Inc.
|
Posted - 2007.12.12 13:47:00 -
[9]
That does seem to be because of a change in PHP 5.2 as per This link
I will post the corrected method tonight after I have tested it. The api seems to be down right now, so I am unable to test. 
|

Flaming Candle
|
Posted - 2007.12.12 16:12:00 -
[10]
Originally by: Moodle
line 23 being : foreach ($xml->result->rowset[0] as &$value) {
I think you can just remove the '&' in that line and it'll work.
|

Ivan Shell
|
Posted - 2007.12.12 23:38:00 -
[11]
It does work with out the "&" here.
|

Pixel8tion
|
Posted - 2007.12.13 08:36:00 -
[12]
Originally by: Ivan Shell It does work with out the "&" here.
Your right !
It works fine ! thanks all, this is a starting place for me to get going.
Regards
Moodle.
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |