|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.17 19:36:00 -
[1]
Its a tough job, but somebody had to do it.
Here's version 0.1 of the PHP Api Library. Its a framework to interface with the EVE Api, so that everyone will be able to retrieve data from the API website, and make their own sites with it. Linkage
How does it work The Api lib consists of multiple specific classes (character sheet, wallet journal) that are extended from the main Api class (class.api.php).
The main Api class does all your downloading and authenticating for you, while the derived classes parse the contents for you. Not all xml's are supported, but you can easily create a class that parses the info for you by extending it from the Api class.
Note This lib supports multi-user xml caching. Cachefolder is setup in class.api.php
Example This code gets all your characters from the API site
Quote:
<?php require_once('./classes/api/class.api.php'); require_once('./classes/api/class.charselect.php');
$select = new CharSelect("USERID", "APIKEY"); $select->debug(true);// enable debugging $select->cache(false);// do not use a cache-file, if one is stored on the disk $chars = $select->getCharacters(); // retrieve api characters
print_r($chars); $select->printErrors(); // display errors ?>
Warranty This is still WIP. I haven't tested all xml's live yet, as I'm not a director in my corp. Also the downloading of the skillTree gave me some troubles on my own server. It chopped the contents in half :(
Have fun with this, and make sure you use the API, and the libs SAFELY. You know where to drop donations :) _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.21 08:02:00 -
[2]
I found the issue regarding the SkillTree. It was the regular expression that stripped the HTML headers from the response that crashed. SkillTree containts characters that regex doesn't like :)
Fixed this using strpos and substr I'll upload a new version today.
Do note that this version has been setup differently, to allow switching between xml's using the same base class. _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.21 13:55:00 -
[3]
New version: (0.2)
This version has changed the way the classes work. use the Api class to download the xml contents, then use these contents as input for the other class. The Api class has the functions to retrieve the raw xml. The other classes are static, so you don't have to instance them.
Example in the first post is updated. _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.22 17:39:00 -
[4]
Do you run this script on a local http server, or at someone's hosting company? If its run at a hosting company, ask Support if they could open the port to api.eve-online.com at port 80. I think outgoing connections are closed with security in mind (ie: botscripts connecting outwards or something) _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.23 16:57:00 -
[5]
Originally by: Shime After retry, i connect, but there is another error :
Fatal error: Call to a member function printErrors() on a non-object in characters.php on line 3
Line 3 in that file is : require_once('./classes/api/class.charselect.php');
Ehehehe, I think I broke my error handler.
Remove "$api->debug(true);", then it should work :) _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.27 17:41:00 -
[6]
*slaps self
'$select' has to be '$api' Sorry about that, forgot to change the name of that variable.
fixing... _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.29 18:04:00 -
[7]
Yeah, it 'might' work. But I didn't test that either. _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.09.11 19:14:00 -
[8]
Originally by: Constance DeKebec I've copy/paste all that you write and replaced USERID and APIKEY, created folder xmlcache, i get those messages :
Error: File does not exist: ./xmlcache/account/Characters.xml.aspx Api: Must provide userID parameter for authentication. Error: File does not exist: ./xmlcache/account/Characters.xml.aspx
Don't understand, previous version worked fine ... 
Was a small error at my snippet at the top. Typed it out of my head without checking it myself :)
It should be correct now, so please try again :) _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.12.25 09:56:00 -
[9]
Originally by: Rynlam *snip* New output:
Array ( [0] => Array ( [charname] => Rynlam [charid] => 120544169 [corpname] => OCForums [corpid] => 878299514 ) ) Error: File does not exist: ./xmlcache/1188020/char/CharacterSheet.xml.aspx Api: Invalid characterID. Error: File does not exist: ./xmlcache/1188020/char/CharacterSheet.xml.aspx Error: File does not exist: ./xmlcache/1188020/char/SkillInTraining.xml.aspx Api: Invalid characterID. Error: File does not exist: ./xmlcache/1188020/char/SkillInTraining.xml.asp
Think the highlighted part says enough ^^ _ Planet Sight Wallpaper - EvE map |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.12.28 19:00:00 -
[10]
Originally by: Rynlam EDIT2:
If I put the charID retrieved from the first function in manually into the api->setCredentials line, then charactersheet stuff works properly. How do I retrieve the charID into a variable to automatically update credentials, though?
after the line "$char = $api->getCharacters();" you can do the following.
$characters = CharSelect::getCharacters($char); $charid = $characters[0]['charid']; // 0 is the first in the array, 1 is the 2nd etc etc.
// then you can set the credentials again $api->setCredentials("userid", "apikey", "CHARID");
// so, instead of "CHARID" (including quotes) you can use $charid $api->setCredentials("foo", "bar", $charid);
_ Planet Sight Wallpaper - EvE map |
|
|
|
|