| Pages: 1 2 3 4 :: [one page] |
| 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 |

Wyehr
Shadow Of The Light R i s e
|
Posted - 2007.08.17 19:42:00 -
[2]
Woohoo! I'll poke at it this weekend and take a look at the corp stuff.
I've been putting this project off for a couple of weeks now because, honestly, I hate writing clean interface classes.
GPLv3 too. Nice.
[ 2007.03.18 18:45:59 ] (notify) Typhoon belonging to Gandolf self-destructs. |

Kali Jav
Caldari Directorat Apocalyptica.
|
Posted - 2007.08.20 16:29:00 -
[3]
Edited by: Kali Jav on 20/08/2007 16:32:52 Nice job ! Testing it atm :) Seems great.
(I have a bug in skilltree too )
I'm waiting for next releases .
|

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.21 08:02:00 -
[4]
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 -
[5]
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 |

Shime
|
Posted - 2007.08.22 12:17:00 -
[6]
Hello,
I try your php and i ve always same errors :
Warning: fsockopen() [function.fsockopen]: unable to connect to api.eve-online.com:80 Fatal error: Maximum execution time of 30 seconds exceeded in .classes\api\class.api.php on line 102
What i do is : Write your example with id and key modify in class.api $params['characterID'] = = xxxx
Don"t have idea now where is the problem... if u can help :)
(php5 ok)
|

Encad Briht
Minmatar Space-Bar FOUNDATI0N
|
Posted - 2007.08.22 15:06:00 -
[7]
Originally by: Shime Edited by: Shime on 22/08/2007 12:47:09 Hello,
I try your php and i ve always same errors :
Warning: fsockopen() [function.fsockopen]: unable to connect to api.eve-online.com:80 Fatal error: Maximum execution time of 30 seconds exceeded in .classes\api\class.api.php on line 102
What i do is : Write your example with my id and key
Don"t have idea now where is the problem... if u can help :)
(php5 ok)
Seems like the server, on which the script runs, cant connect to the EVE-API, tries over and over and time-outs then, so probably a problem on your side.
|

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.22 17:39:00 -
[8]
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 |

Shime
|
Posted - 2007.08.23 13:12:00 -
[9]
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');
|

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.08.23 16:57:00 -
[10]
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 |

Shime
|
Posted - 2007.08.24 08:55:00 -
[11]
k,
Now another error :
Fatal error: Call to a member function printErrors() on a non-object in characters.php on line 11
ligne 11 is : $select->printErrors(); // display errors
(i'm under php5 -- so ?? 
|

Cytech
Caldari Fun Inc
|
Posted - 2007.08.27 11:19:00 -
[12]
I'm also getting the same error, i did a bit of googling and found that $select needs to be defined before being used with the function? but i'm not sure what it needs to be defined as, im kind of new to php :(
|

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

Dioh Kado
Galactic Fighter Syndicate Knights Of the Southerncross
|
Posted - 2007.08.28 11:56:00 -
[14]
Hi there, have checked twice but didn't found the required PHP version. I am running php 4.3.10 and I am getting this error:
Quote: Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /somepath/classes/api/class.api.php on line 21
I suspect that php5 is reqired?
In any case a good job, pal!
Cheers
Dioh
|

Wyehr
Shadow Of The Light R i s e
|
Posted - 2007.08.28 16:11:00 -
[15]
You don't seem to have a constructor. Try this for the example code:
Quote:
<?php require_once('./classes/api/class.api.php'); require_once('./classes/api/class.charselect.php');
$api = new Api(); $api->setCredentials("USERID","APIKEY");
$api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one is stored on the disk $contents = $api->getCharacters(); // retrieve api characters XML file
print_r(CharSelect::getCharacters($contents)); $api->printErrors(); // display errors ?>
[ 2007.03.18 18:45:59 ] (notify) Typhoon belonging to Gandolf self-destructs. |

Tapin Tegellan
Mercenaries of Andosia Veritas Immortalis
|
Posted - 2007.08.28 16:14:00 -
[16]
Another error for you :)
Fatal error: Class 'SimpleXMLElement' not found in <my www dir>/htdocs/eve/api/class.api.php on line 137
This was using: PHP Version 5.2.4_pre200708051230-pl2-gentoo
|

dimensionZ
Reikoku Band of Brothers
|
Posted - 2007.08.28 17:03:00 -
[17]
Originally by: Tapin Tegellan Another error for you :)
Fatal error: Class 'SimpleXMLElement' not found in <my www dir>/htdocs/eve/api/class.api.php on line 137
This was using: PHP Version 5.2.4_pre200708051230-pl2-gentoo
You need simpleXML extension. ----------------------------------------
|

AliasXNeo
Gallente
|
Posted - 2007.08.28 18:47:00 -
[18]
Edited by: AliasXNeo on 28/08/2007 18:47:37
Originally by: Tapin Tegellan Another error for you :)
Fatal error: Class 'SimpleXMLElement' not found in <my www dir>/htdocs/eve/api/class.api.php on line 137
This was using: PHP Version 5.2.4_pre200708051230-pl2-gentoo
Last time I checked SimpleXML came with the PHP 5.x installations.
http://php.net/simplexml
~ Eve Online API Programmer ~ - Evewebspace Developer - Like my stuff? Donate to Neo XX! |

Dioh Kado
Galactic Fighter Syndicate Knights Of the Southerncross
|
Posted - 2007.08.29 06:31:00 -
[19]
Originally by: Wyehr You don't seem to have a constructor. Try this for the example code:
Quote:
<?php require_once('./classes/api/class.api.php'); require_once('./classes/api/class.charselect.php');
$api = new Api(); $api->setCredentials("USERID","APIKEY");
$api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one is stored on the disk $contents = $api->getCharacters(); // retrieve api characters XML file
print_r(CharSelect::getCharacters($contents)); $api->printErrors(); // display errors ?>
Thx for your reply, but already the first line (the require) causes the error. Seems like my PHP doesn't like classes. Any Ideas?
regards
Dioh
|

Dioh Kado
Galactic Fighter Syndicate Knights Of the Southerncross
|
Posted - 2007.08.29 11:08:00 -
[20]
Ok, got it. The Classes-Model changed form php4 to php5 and so php5 is required to use these classes without modification.
07
Dioh
|

Tapin Tegellan
Mercenaries of Andosia Veritas Immortalis
|
Posted - 2007.08.29 12:59:00 -
[21]
Originally by: dimensionZ
Originally by: Tapin Tegellan Another error for you :)
Fatal error: Class 'SimpleXMLElement' not found in <my www dir>/htdocs/eve/api/class.api.php on line 137
This was using: PHP Version 5.2.4_pre200708051230-pl2-gentoo
You need simpleXML extension.
Yes your quite right just noticed "--disable-simplexml'" in Configure Command :)
|

Wyehr
Shadow Of The Light R i s e
|
Posted - 2007.08.29 18:00:00 -
[22]
I don't remember all the changes to the class system going from php4 to php5, but I think that the "private" and "public" keywords are new. Removing those from all the element and method definitions inside all the classes might help it work. I don't think I've still got a copy of php4 around to test it on.
[ 2007.03.18 18:45:59 ] (notify) Typhoon belonging to Gandolf self-destructs. |

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

AliasXNeo
Gallente
|
Posted - 2007.08.29 18:18:00 -
[24]
Originally by: Wyehr I don't remember all the changes to the class system going from php4 to php5, but I think that the "private" and "public" keywords are new. Removing those from all the element and method definitions inside all the classes might help it work. I don't think I've still got a copy of php4 around to test it on.
Private, public, static, overloading, dynamic calling, a lot of stuff changed in classes from PHP 4 to 5. If your still running 4 you need to upgrade ASAP :p ~ Eve Online API Programmer ~ - Evewebspace Developer - Like my stuff? Donate to Neo XX! |

Ki Shodan
Gallente deep blue
|
Posted - 2007.08.29 18:51:00 -
[25]
Originally by: AliasXNeo Private, public, static, overloading, dynamic calling, a lot of stuff changed in classes from PHP 4 to 5. If your still running 4 you need to upgrade ASAP :p
That might not be possible for everyone in the near future. But on the other hand even free hosting services will have upgraded in a few month or so ... --
Evemail me, if my name is used as guarantor! |

Wyehr
Shadow Of The Light R i s e
|
Posted - 2007.08.30 01:55:00 -
[26]
couple of bugs.
In class.api.php, in the retrieveXml function, $params is defaulted as null, then overwritten as an empty array, clobbering whatever you pass in.
Line 76:
public function retrieveXml($path, $params = array() )
Line 80 needs to be removed:
// $params = array();
Line 155, the cache gets written regardless of the usecache setting because it is checking isCached() instead:
if (!this->usecache)
[ 2007.03.18 18:45:59 ] (notify) Typhoon belonging to Gandolf self-destructs. |

Wyehr
Shadow Of The Light R i s e
|
Posted - 2007.08.30 13:12:00 -
[27]
I wanted to add a function to the base class to walk the walllet journal and transactions. Turns out that my wallet isn't busy enough. Anyone care to test this?
public function getWalletTransactionsAll($corp = false, $accountkey = 1000, $afterid = null) { $contents = array();
$needmore = true; $before = null;
$cache_status=$this->usecache; $this->cache(false);
while ($needmore ) { $batch = $this->getWalletTransactions($before, $corp, $accountkey); $transactions = Transaction::getTransaction($batch); if (0 == count($transactions)) { $needmore = false; } else { foreach( $transactions as $transaction ) { $before = $transaction['transactionID']; $contents[]=$transaction; if( $afterid == $transaction['transactionID']) { $needmore = false; } } if (1000 != count($transactions)) { $needmore = false; } } }
$this->cache($cache_status);
return $contents; }
[ 2007.03.18 18:45:59 ] (notify) Typhoon belonging to Gandolf self-destructs. |

AliasXNeo
Gallente
|
Posted - 2007.08.30 19:06:00 -
[28]
Originally by: Ki Shodan Edited by: Ki Shodan on 29/08/2007 18:57:33
Originally by: AliasXNeo Private, public, static, overloading, dynamic calling, a lot of stuff changed in classes from PHP 4 to 5. If your still running 4 you need to upgrade ASAP :p
That might not be possible for everyone currently. But on the other hand even free hosting services will have upgraded in a few month or so ...
Removing those keywords will not work, there are build-in functions/classes like simpleXML used, that come with 5.0 and later only. So to use it on php4, the api would have to be rewritten in many parts. But the benefit of doing so would be questionable, since the update from php4 to php5 will come to any hosting service soon(tm) anyway. :-)
I personally have not ran into a host that does not have PHP 5 installed. What happens is that most hosts still for some odd reason have PHP 4 as the default parser, and therefor people assume their host must not support PHP 5, when in reality if you add a few commands to your .htaccess you can force your scripts to be parsed by the PHP 5 engine. I'll see if I can find the commands. ~ Eve Online API Programmer ~ - Evewebspace Developer - Like my stuff? Donate to Neo XX! |

Perin Ashedge
Minmatar Total Information Technology
|
Posted - 2007.09.01 22:31:00 -
[29]
Will it append new additions to data or does it dump it? I am looking for an easier way to keep track of old data, and right now I just backup the xml files, which is a pain when there is only one change or something... a lot of extra space wasted.
|

Constance DeKebec
|
Posted - 2007.09.10 18:15:00 -
[30]
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 ... 
|

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.09.11 19:14:00 -
[31]
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 |

Constance DeKebec
|
Posted - 2007.09.11 21:38:00 -
[32]
Thanks, i didn't even though to do that :/ it works now :)
Again, nice job, i managed to make some cool stuff for my carebear char 
|

Z011
|
Posted - 2007.09.16 15:37:00 -
[33]
too bad it is dependent on php5.
needs http_build_query() and probably more.
The class stuff was easy enough to 'fix', just drop all the public, private, static keywords. Bu, unfortunately....
Time to port PHP5 to AIX I guess. |

Shinhan
Phoenix Knights Dark Nebula Galactic Empire
|
Posted - 2007.09.16 20:58:00 -
[34]
Originally by: Z011 too bad it is dependent on php5.
needs http_build_query() and probably more.
The class stuff was easy enough to 'fix', just drop all the public, private, static keywords. Bu, unfortunately....
Time to port PHP5 to AIX I guess.
http_build_query() doesn't look complicated. There are couple examples at php.net for emulating this function on PHP 4 that look like they would work...
-- Selling apples, 1 signature each. ѼѼѼѼѼѼѼ |

Dead6re
Amarr The Knighthawks FREGE Alliance
|
Posted - 2007.09.17 13:16:00 -
[35]
Edited by: Dead6re on 17/09/2007 13:16:02 Find: $poststring = http_build_query($params);
Replace:
$poststring = "userID=".$params['userID']."&apiKey=".$params['apiKey'];
if ($params['characterID'] != null) $poststring .= "&characterID=".$params['characterID'];
|

Ryushe
M. Corp M. PIRE
|
Posted - 2007.09.24 16:13:00 -
[36]
I got PHP5 running, got your latest API classes, changed the caching part as per Wyehrs directions. Now when running your little example code there, of course with correct userID and APIKey, I do get a list of all characters on that account, but I also get this: "Error: File does not exist: ./xmlcache/<userID>/account/Characters.xml.aspx" (<userID> substituted for actual userID obviously) Now I've made an xmlcache dir in both basedir and the class dir, chmodded them both to 777 just to be sure, changed ownership of the directory to the web user, and still I get that message. I've tried absolute paths, relative paths, etc etc. Any ideas?
----------------------- Vi veri veniversum vivus vici!
|

Atari Commodore
|
Posted - 2007.09.26 21:58:00 -
[37]
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
I'm having a similar problem:
Quote: Error: File does not exist: ./xmlcache/421527/account/Characters.xml.aspx Api: Must provide userID parameter for authentication. Error: File does not exist: ./xmlcache/421527/account/Characters.xml.aspx
Stumped.
|

Atari Commodore
|
Posted - 2007.09.28 16:40:00 -
[38]
Anyone any idea why this is happening?
Tearing my hair out here...
|

Rynlam
Gallente
|
Posted - 2007.12.24 19:06:00 -
[39]
Edited by: Rynlam on 24/12/2007 19:10:42 Edited by: Rynlam on 24/12/2007 19:08:43 Edited by: Rynlam on 24/12/2007 19:07:50 Reviving this :) Anyway, the retrieve characters function shown works just fine for me. I have no idea how to work cURL, though, so I assume my problem with getSkillInTraining is with the print_r part. Here's my code: (without my API key)
<?php require_once('./api/class.api.php'); require_once('./api/class.charselect.php'); require_once('./api/class.charactersheet.php');
$api = new Api(); $api->setCredentials("7-characters","64-characters"); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $contents = $api->getCharacters(); // retrieve API characters XML file $skilltrn = $api->getSkillInTraining(); // retrieve API characters SIT
print_r(CharSelect::getCharacters($contents)); print_r(CharacterSheet::getSkillInTraining($skilltrn)); $api->printErrors(); // display errors ?>
I get: Array ( [0] => Array ( [charname] => Rynlam [charid] => 120544169 [corpname] => OCForums [corpid] => 878299514 ) ) Array ( [rowset] => ) Error: File does not exist: ./xmlcache/1188020/char/SkillInTraining.xml.aspx Api: Invalid characterID. Error: File does not exist: ./xmlcache/1188020/char/SkillInTraining.xml.aspx
|

Rynlam
Gallente
|
Posted - 2007.12.24 19:17:00 -
[40]
Thought it might be because I hadn't retrieved the charactersheet yet. New code:
<?php require_once('./api/class.api.php'); require_once('./api/class.charselect.php'); require_once('./api/class.charactersheet.php');
$api = new Api(); $api->setCredentials("blah","diddly"); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $contents = $api->getCharacters(); // retrieve API character XML file $character = $api->getCharacterSheet(); // retrieve API character sheet $skilltrn = $api->getSkillInTraining(); // retrieve API character SIT
print_r(CharSelect::getCharacters($contents)); print_r(Charactersheet::getCharacterSheet($character)); print_r(Charactersheet::getSkillInTraining($skilltrn)); $api->printErrors(); // display errors ?>
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
|

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.12.25 09:56:00 -
[41]
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 |

Coconut Joe
VIRTUAL LIFE VANGUARD Te-Ka
|
Posted - 2007.12.25 13:27:00 -
[42]
Originally by: Z011 too bad it is dependent on php5.
needs http_build_query() and probably more.
The class stuff was easy enough to 'fix', just drop all the public, private, static keywords. Bu, unfortunately....
Time to port PHP5 to AIX I guess.
How very lazy 
Try http://uk.php.net/manual/en/function.http-build-query.php#57424 - Eve IGB Store Template - The complete eve retail solution. |

Rynlam
Gallente
|
Posted - 2007.12.25 18:05:00 -
[43]
Originally by: Kw4h Think the highlighted part says enough
It says invalid characterID. I have looked through the code and I'm not seeing where to input the characterID for the Charactersheet class. (BTW, is that meant to be capitalized differently than all the other classes?)
|

Zafar
|
Posted - 2007.12.27 20:02:00 -
[44]
Hi,
I probably suck too much at PHP to use this API, because I'm always getting this error message:
Quote:
Warning: mkdir() [function.mkdir]: Permission denied in /home/filtered/htdocs/dev/jewperapi/include/api/class.api.php on line 189
Warning: fopen(./xmlcache/687369/account/Characters.xml.aspx) [function.fopen]: failed to open stream: No such file or directory in /home/www-folke/htdocs/dev/jewperapi/include/api/class.api.php on line 192 Array ( [0] => Array ( [charname] => filtered [charid] => 712441404 [corpname] => filtered [corpid] => 920892) [1] => Array ( [charname] => Zafar [charid] => 931632819 [corpname] => Zorg Corporation [corpid] => 949675640 ) ) Error: File does not exist: ./xmlcache/687369/account/Characters.xml.aspx Error: File does not exist: ./xmlcache/687369/account/Characters.xml.aspx Error: Could not open file for writing: ./xmlcache/687369/account/Characters.xml.aspx
- Z. |

Kw4h
Dragon's Rage Intrepid Crossing
|
Posted - 2007.12.28 19:00:00 -
[45]
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 |

Rynlam
Gallente
|
Posted - 2008.01.03 16:04:00 -
[46]
Code:<html> <head><title>EVE API</title></head> <body bgcolor="#000000" text="#00CCCC"> <center><h1>EVE API</h1></center> <?php require_once('./api/class.api.php'); require_once('./api/class.charselect.php');
$api = new Api(); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $api->setCredentials($apiuser,$apipasskey); $apichars = $api->getCharacters(); // retrieve API character XML file $apicharacters = CharSelect::getCharacters($apichars); $apicharid = $apicharacters[0]['charid']; $apicharcorp = $apicharacters[0]['corpname']; echo "<br />Character ID: ".$charid; echo "<br />Corporation: ".$charcorp; //$api->setCredentials($apiuser,$apipasskey,$charid); $api->printErrors(); // display errors ?> </body> </html>
Output:EVE API
Character ID: Corporation: Error: File does not exist: ./xmlcache/1188020/account/Characters.xml.aspx Error: File does not exist: ./xmlcache/1188020/account/Characters.xml.aspx
|

Xaroth Brook
Minmatar BIG Ka-Tet
|
Posted - 2008.01.09 00:05:00 -
[47]
I think a lot is doable in php4, except simpleXml as I don't think that runs on php4 by default... you might want to check PEAR to see if there's a php4 version of simpleXml..
It was like a baby, it landed on my lap and was helpless and totally defenseless. Then I shot it and bragged about it on a killboard.
|

DeTox MinRohim
Madhatters Inc. Enuma Elish.
|
Posted - 2008.01.09 07:44:00 -
[48]
Edited by: DeTox MinRohim on 09/01/2008 07:45:34
Originally by: Xaroth Brook I think a lot is doable in php4, except simpleXml as I don't think that runs on php4 by default... you might want to check PEAR to see if there's a php4 version of simpleXml..
I never could walk the line of full php5 especially since I still see many many hosting keeping php4 by default. And my coding style is dumb anyway to get a clue.
For a simpleXML replacement, this nifty file does the trick (was made to read files but I modified it to read variable content on the fly instead of only files).
xml parser
Was meant to parse files but I made it so that you can parse variables without the need of a file.
Example (just a grab of a few lines from the skillsheet stuff) :
// $data = Containing your xml stuff
include_once('includes/xml.php'); $parse = XML_parsecontent($data);
echo '<pre>'; print_r($parse); echo '</pre>';
Replace XML_parsecontent by XML_parsefile if you're reading a file instead. ------ This sig space is Read-only ! omgalink - Online Skillsheet |

seren10pity
|
Posted - 2008.02.12 09:06:00 -
[49]
Hi,
I just put the code linked by the author
<?php require_once('class.api.php'); // Verified the path is good, I have an error if not. require_once('class.charselect.php'); // Verified the path is good, I have an error if not.
$api = new Api(); $api->setCredentials("my_user_id", "my_api_key"); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one is stored on the disk $contents = $api->getCharacters(); // retrieve api characters XML file
print_r(CharSelect::getCharacters($contents)); $api->printErrors(); // display errors ?>
And I get this error : <?php Error: File does not exist: ./xmlcache/1955767/account/Characters.xml.aspx Api: Invalid username and/or password passed to UserData.LoginWebUser(). Error: File does not exist: ./xmlcache/1955767/account/Characters.xml.aspx ?>
I read post that people that have the same problem than mine, I test lots of modification to make it work, I always get this error. My user id and api key are correct, I can use the other PHP class on the eve dev wiki, but this one is more complete....
What should I do to fix that ?
|

Rynlam
Gallente
|
Posted - 2008.02.16 18:04:00 -
[50]
Store the array to a variable before using print_r on it.
|

KtoJest
Minmatar
|
Posted - 2008.02.20 20:08:00 -
[51]
To the assembled wisdom-
i hope this thread is still alive. :) would some one give me a clue as to what i'm doing wrong here.
<?php require_once('./classes/api/class.api.php'); require_once('./classes/api/class.charselect.php'); require_once('./classes/api/class.balance.php'); require_once('./classes/api/class.charactersheet.php'); require_once('./classes/api/class.generic.php'); require_once('./classes/api/class.membertrack.php'); require_once('./classes/api/class.transaction.php'); require_once('./classes/api/class.walletjournal.php');
$user= '********'; $pass= '***********************************************'; $charID= '*********';
// example code works just fine $api = new Api(); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $api->setCredentials($user,$pass); $apichars = $api->getCharacters(); // retrieve API character XML file $apicharacters = CharSelect::getCharacters($apichars); $apichar = $apicharacters[0]['charid']; $apicharname = $apicharacters[0]['charname']; $apicharcorp = $apicharacters[0]['corpname']; echo "<br />Character ID: ".$apichar; echo "<br />Character Name: ".$apicharname; echo "<br />Corporation: ".$apicharcorp; echo "<br><br>"; $api->setCredentials($apiuser,$apipass,$charID); $api->printErrors(); // display errors
//this does not work $api = new Api(); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $api->setCredentials($user,$pass); $Tng = $api->getSkillInTraining(); // retrieve API skills XML file
$api->setCredentials($user,$pass,$charID); <<with or without this line, same result $api->printErrors(); // display errors ?>
Error: File does not exist: ./xmlcache/********/char/SkillInTraining.xml.aspx Api: Invalid characterID. Error: File does not exist: ./xmlcache/********/char/SkillInTraining.xml.aspx
Why/ere is my characterID invalid/ated?
|

Rynlam
Gallente
|
Posted - 2008.02.21 02:10:00 -
[52]
$api = new Api(); $api->setCredentials($user,$pass,$charid); $skit = $api->getSkillInTraining(); print_r($skit);
You can't find out what skill is training if you don't tell it which character you're looking at. Looks like you just randomly stuck the setCredentials line with charid to the end of your code.
|

KtoJest
Minmatar
|
Posted - 2008.02.21 10:24:00 -
[53]
thanx Rynlam-
don't know where my head had gone. last honest code i'd written was in Pascal. another lifetime.
...and thanx Kw4h for the great code.
the best-
|

Casabian
Gallente Seven. Enuma Elish.
|
Posted - 2008.02.22 21:03:00 -
[54]
I keep getting the error
"Api: Invalid username and/or password passed to UserData.LoginWebUser()."
I'm using the correct userID, and apiKey, but it doesn't seem to validate.
For referece - I'm using the same code as Rynlam's html page above.
Thanks Casa ------------------------------------------------ Casabian - Everyone loves magical Trevor. |

Andy Moo
|
Posted - 2008.02.25 12:47:00 -
[55]
So how would I use the skill sheet data to get a total SP value. Everything I've tried gives a zero output.
|

Padyn
Black Eclipse Corp Band of Brothers
|
Posted - 2008.02.25 15:44:00 -
[56]
Originally by: Andy Moo So how would I use the skill sheet data to get a total SP value. Everything I've tried gives a zero output.
This is how I have done a total SP:
... $api->setCredentials($apiuser,$apipass,$apichar); $charsheet = $api -> getCharacterSheet(); // retrieve API character sheet $skills = Charactersheet::getCharacterSheet($charsheet);
$sp = 0; foreach($skills['skills'] as $sk) { $sp += $sk['skillpoints']; } echo '<br/>Skillpoints: '.number_format($sp);
Nemo Me Impune Lacessit - "No one strikes me with impunity" |

Rynlam
Gallente
|
Posted - 2008.02.26 16:23:00 -
[57]
Kw4h, are you planning on updating the classes for the new API functions anytime soon? Should I be waiting for the "official" version or should I just hack up my own?
|

Rynlam
Gallente
|
Posted - 2008.02.27 16:27:00 -
[58]
Edited by: Rynlam on 27/02/2008 16:27:10 If anybody wants it, I've got an AllianceList class done. class.alliancelist.php and 4 additional lines in class.api.php. The array output is slightly biased to work easily on my site, but isn't too hard to modify if you know how to mess with nested foreach($array as $key=>value) stuff. Output array looks like:
Alliances => Array( [101010 Alliance] => Array( [membercorp1idhere] => "membercorp1startdate" [membercorp2idhere] => "membercorp2startdate" ) [secondalliancename] => Array( [firstmembercorp] => "firstmembercorpstart" ) [allianceid1] => "101010 Alliance" [allianceid2] => "secondalliancename" ) And so on.
Working on a CorporationSheet class now.
|

Rynlam
Gallente
|
Posted - 2008.03.05 17:57:00 -
[59]
Have a basically working class.corporationsheet.php but I need to make it read the rowsets "accountkeys" and "logo" properly still. Having $api->cache(true) breaks it however, as it loads whatever is cached no matter whether $corpid is set or not. Any way from within the getCorporationSheet function to disable caching for that function?
|

Rynlam
Gallente
|
Posted - 2008.03.06 22:49:00 -
[60]
Kw4h, are you alive anymore?
Anyway, I've completed class.corporationsheet.php. Requires some modifications to class.api.php, to support using corporatinID in setCredentials.
Example php file:
$apiuser = "7or8digits"; $apipass = "64charactersazAZ09"; $apichar = "acharacterIDontheaccount"; $apicorp = "anycorpIDhere"; $api = new Api(); $api->debug(false); $api->cache(false); $api->setCredentials($apiuser,$apipass,$apichar); // Returned corporation will be the character's corp, and will include wallet divisions and such //$api->setCredentials($apiuser,$apipass,$apichar,$apicorp); // Returned corporation will be the specified corpID, and will not include information unless you select the corpID the character is in, which would be kind of pointless $ucorp = $api->getCorporationSheet(); $corp = Corporationsheet::getCorporationSheet($ucorp);
echo '<html>'; echo '<head><title>Corpsheettest</title></head>'; echo '<body style="background:#000000; color:#C0C000;">'; echo '<pre>'; echo '<hr color="orange" />'; print_r($corp); echo '<hr color="orange" />'; echo '</pre>'; echo '</body>'; echo '</html>';
Will return:
Array ( [corporationID] => 230445889 [corporationName] => Mindstar Technology [ticker] => MNDS [ceoID] => 1778331558 [ceoName] => Hodur [stationID] => 60011572 [stationName] => Osmeden IX - Moon 6 - University of Caille School [description] => You can do anything you set your mind to when you have vision, determination and an endless suppply of expendable labor. [url] => http://mindstar.dimensionjump.com [allianceID] => 936628053 [allianceName] => The Kano Organisation [taxRate] => 10 [memberCount] => 120 [shares] => 11000 [logo] => Array ( [graphicID] => 0 [shape1] => 567 [shape2] => 574 [shape3] => 513 [color1] => 676 [color2] => 679 [color3] => 680 ) )
If you have priveleges to see the corp wallet info, additional data is included in the array:
[divisions] => Array ( [0] => Array ( [accountKey] => 1000 [description] => RECYCLE BIN ) [1] => Array ( [accountKey] => 1001 [description] => SHIPS AND EQUIPMENT ) [2] => Array ( [accountKey] => 1002 [description] => MANUFACTURING ) [3] => Array ( [accountKey] => 1003 [description] => CORP PLAN ITEMS ) [4] => Array ( [accountKey] => 1004 [description] => ORE AND MINERALS ) [5] => Array ( [accountKey] => 1005 [description] => MISCELLANEOUS AND FREE STUFF ) [6] => Array ( [accountKey] => 1006 [description] => AMMUNITION ) ) [walletDivisions] => Array ( [0] => Array ( [accountKey] => 1000 [description] => Master Wallet ) [1] => Array ( [accountKey] => 1001 [description] => 2nd Wallet Division ) [2] => Array ( [accountKey] => 1002 [description] => Andarys Embezzlement fund ) [3] => Array ( [accountKey] => 1003 [description] => 4th Wallet Division ) [4] => Array ( [accountKey] => 1004 [description] => 5th Wallet Division ) [5] => Array ( [accountKey] => 1005 [description] => 6th Wallet Division ) [6] => Array ( [accountKey] => 1006 [description] => 7th Wallet Division ) )
|

Rynlam
|
Posted - 2008.03.06 23:55:00 -
[61]
I've added my stuff to wiki.eve-dev.net
|

Kanmahr
|
Posted - 2008.05.30 12:04:00 -
[62]
Hello, wondering you can help
After a few retrievals (cached or not) the getSkillTree call throws the following error:
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 5492: parser error : out of memory error in /php/api/class.api.php on line 273
It's the first thing I call in my file. Anyone else have issues with this?
|

Aepod
|
Posted - 2008.06.01 01:36:00 -
[63]
I am seeing the same error. Anyone have any luck fixing it?
|

deadmeet
|
Posted - 2008.06.05 16:06:00 -
[64]
can somebody upload somewhere the php class you can find on the eve dev wiki ? the website is down...
|

Jessica May
|
Posted - 2008.06.09 13:49:00 -
[65]
Edited by: Jessica May on 09/06/2008 13:54:25 Edited by: Jessica May on 09/06/2008 13:54:08 <?php require_once('class.api.php'); require_once('class.charselect.php'); require_once('class.balance.php'); require_once('class.charactersheet.php'); require_once('class.generic.php'); require_once('class.membertrack.php'); require_once('class.transactions.php'); require_once('class.walletjournal.php');
$user= 'blah'; $pass= 'blah'; $charID= 'blah';
$api = new Api(); $api->debug(true); $api->cache(false); $api->setCredentials($user,$pass,$charID); $Tng = $api->getSkillInTraining();
$api->printErrors(); ?>
Gives me: Error: File does not exist: ./xmlcache/blah/char/SkillInTraining.xml.aspx Api: Invalid characterID. Error: File does not exist: ./xmlcache/blah/char/SkillInTraining.xml.aspx
(replace blah with actual info). It's as if it's looking in the wrong place. Anyone help? I've basic PHP skills and trying to learn on the job.
EDIT: Forget it, schoolboy error!
|

deadmeet
|
Posted - 2008.06.17 20:50:00 -
[66]
Hi,
It is possible to have an example of code to get the global skilltree ?
This call don't require the userId or APIkey, so there is no need to use the setcredential function I imagine, but not sure.
I would like to see an example of that please.
thanks in advance.
|

xconspirisist
|
Posted - 2008.06.20 23:51:00 -
[67]
This thing could really do with a very simple readme, because the way in which your code is structured is quite obscure, although I do appreciate your efforts.
I am trying to get the skill currently in training just for the moment, yet can't figure out how I am supposed to do that, as things like $api->getSkillInTraining and associated methods always return null! A little code a example in this forum would probably be ample, many thanks in advance.
|

Steven Sayers
Fluid Group Dynamics
|
Posted - 2008.06.21 01:46:00 -
[68]
This is a very exciting project you are working on and I hope it continues to be successful!
|

Hylax Ciai
Starlancer United
|
Posted - 2008.06.22 08:36:00 -
[69]
Anyone knows how to avoid this error?
Quote: 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
code:
Quote: function check_reg($userid, $apikey) { $allowed = array ("*****"); //$allowed is an array of allowed corps. Will be loaded from database later on. require_once('./api/class.api.php'); require_once('./api/class.charselect.php');
$apiuser = $userid; $apipass = $apikey;
$api = new Api(); $api->debug(true); // enable debugging $api->cache(false); // do not use a cache-file, if one exists $api->setCredentials($apiuser,$apipass);
$apichars = $api->getCharacters(); // retrieve API character XML file $apicharacters = CharSelect::getCharacters($apichars);
$apichar = $apicharacters[0]['charid']; $apicharcorp = $apicharacters[0]['corpname'];
echo "<br />Character ID: ".$apichar; echo "<br />Corporation: ".$apicharcorp;
$api->printErrors(); // display errors }
Calling the function like this:
Quote: $userid = htmlspecialchars($_POST['userid']); $apikey = htmlspecialchars($_POST['apikey']); check_reg($userid,$apikey);
Saw some other people getting the same error.
|

Lumy
Minmatar Templars of Space
|
Posted - 2008.06.28 21:46:00 -
[70]
Edited by: Lumy on 28/06/2008 21:46:42 Another issue:
I needed function to retrieve Corporation Sheet. So I extended (EveHelperApi extends Api) original class and added my function.
Quote:
public function getCorporationSheet($corpid) { $params = array(); $params['corporationID'] = $corpid; return $this->retrieveXml("/corp/CorporationSheet.xml.aspx", $params); }
This won't work because on line 80 method retrieveXml rewrites $params parameter. So I had to replace it with
Quote:
if (!is_array($params)) { $params = array(); }
Hope this helps you. Is there anyone working on this class anymore?
Joomla! in EVE - IGB compatible CMS. |

Lumy
Minmatar Templars of Space
|
Posted - 2008.06.28 22:05:00 -
[71]
Originally by: Rynlam see last post on previous page
I'm afraid both mine oand yours solution will mess up with one thing - caching :( Sorry I've noticed it this late (past midnight here)). I'll try to post suggestion how to fix this later(TM).
Joomla! in EVE - IGB compatible CMS. |

Dark Fibre
|
Posted - 2008.06.29 00:49:00 -
[72]
I'm going to bed now, banging my head trying to make a php page display all the members in a corp (using a director api).
If anybody can supply a working page or at least point me in the right direction I will line your pockets with iskies!
Thanks,
DF |

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.03 02:16:00 -
[73]
DF, I sent you EveMail. I'll be happy to work with you :)
Rynlam, Lumy, I have an idea on how to fix the caching issue: The trouble is that the cache does not know corpID, just charID. Teaching it corpID would fix that particular problem.
However, I don't just want to do that - there are more issues with the cache, for example, for walletJournal, it would need to know refID too, or something along those lines, so that caching does not mess with retrieving more than 1000 journal lines. There may be more API functions like that that have such issues.
The "raw XML caching in a directory" method has an advantage - it's easy and quick. I think DB caching would be overkill for this little thing. But still, rethinking the way caching works and making it work for more API functions - and being able to set cache timeout individually, while respecting EvE API's caching time - would be a good thing. That last one is for functions that you may want to keep cached for 24 hours or so on your webpage.
I'll ponder this for a bit. In the meantime, my class.api.php is changing - is it time to throw this thing into a source repository? Or just keep tinkering with it for a bit and then release a "0.21", since Kw4h appears to be MIA?
|

Lumy
Minmatar Templars of Space
|
Posted - 2008.07.03 07:44:00 -
[74]
Edited by: Lumy on 03/07/2008 07:45:10 The class definitely needs better way to build cache file path. Something that would allow build it based on passed parameters.
My suggestion: add third parameter to retrieveXML method: $cachePath. then rework getCacheFile to something like this:
Quote:
private function getCacheFile($params, $cachePath) { $realpath = $this->cachedir; foreach ($cachePath as $segment) { if (isset($params[$segment])) { $realpath .= DIRECTORY_SEPARATOR.$params[$segment]; } else { $realpath .= DIRECTORY_SEPARATOR.$segment; } return $realpath; }
and minor detail, you definitely could use something like this:
Quote:
public function setCacheDir($dir) { $this->cachedir = $dir; }
In case, that you have application with several roots (e.g. root/ and root/adminstrator), but you want them to use the same cache directory. |

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.03 10:27:00 -
[75]
I like that idea. While we're setting the path, how about also passing along the timeout? That way, it would be individual per API function. You'd want a way to set the timeout "from the outside", too, ideally.
Alright, we need to be able to collaborate on this code. Got a suggestion for a source repository? Of course, there's always SourceForge, I suppose.
|

Lumy
Minmatar Templars of Space
|
Posted - 2008.07.03 12:32:00 -
[76]
Ehm:
Permission Denied
Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance.
Joomla! in EVE - IGB compatible CMS. |

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.03 16:16:00 -
[77]
Edited by: Yorick Downe on 04/07/2008 04:26:25 Edited by: Yorick Downe on 03/07/2008 16:27:52 SourceForge literally just now approved the project. Try again, you should see the page now. I'm at work for another 6-7 hours - I'll go upload stuff to SVN and process your dev access (if you can get the app in before then :)) when I come home.
[edit - let's use SVN, it's so much nicer overall. Didn't know SF did SVN as well as CVS, sweet]
[Edit2]
- SVN repository has been seeded - I've added your caching logic suggestions, Lumy, if slightly modified - I've also added individual timeouts and "cachethis" bools to all get functions - Fixed a bug that broke any get function that actually passed a $param. D'oh. - And annotated some stuff that I think should be changed
I've tested the new caching logic on wallet transactions, works nicely. Full regression testing for all get functions is needed and has not yet been done.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.04 06:24:00 -
[78]
Edited by: Yorick Downe on 04/07/2008 17:49:51 Edited by: Yorick Downe on 04/07/2008 17:49:32 Edited by: Yorick Downe on 04/07/2008 17:48:36 Testing is going well so far. Fixed the way the getAccountBalance parser works, it wasn't in line with how all the others do their thing.
I am currently questioning the design of this library. Everything's done in a one-two-punch of:
require_once('./classes/eveapi/class.api.php'); require_once('./classes/eveapi/class.something.php');
$dataxml = $Api->getSomething(); $data = Something::getSomething($dataxml); // Start working with the $data array
Now, yes, that gives me a way to get the raw XML. But - why would I ever want that? Couldn't I save myself some coding hassle by "folding" it all in and then doing:
require_once('./classes/eveapi/class.api.php');
$data = $Api->getSomething(); // Start working with the $data array
Got still a few edges to polish before a 0.21 can be released, and I want to give Lumy and Rynlam a chance to look at it. 0.21 integrates Lumy's and Rynlam's work, and beyond that just fixes some bugs that really needed fixing. 0.21 will work with code that was written for 0.20 without needing to change that code.
I'm thinking that after 0.21, it's time to do away with the "one-two-punch" for 0.30, and add all current API functions. That would, yes, break existing code. That's the drawback. I don't know how widely used this API library is, though. It might not be such a biggy, and judging from the comments in this thread, people get rather confused by the way the library does things.
Please, if you have a stake in this either way, let us all know.
[Edit]
Answered my own question - the legacy way of grabbing the data will stay, to not break existing apps. I'll add qgetSomething functions, for "quick-get", that will skip the xml part and deliver an array directly.
Alright, good progress has been made. 0.21 is close to ready - it fixes bugs and brings the existing library to a level where caching works throughout and all functions and classes follow a common naming convention. There's also some parameter checking so those pesky non-numeric charids will be more obvious :). Don't worry, the old class and function names are still here, too, the aim is not to break any existing code.
There's one bit left for 0.21 that may either not get done until later or I'll need help with: Creating parsers for starbase list and starbase detail. I don't have a char that owns a POS corp to test these. 0.20 had xml retrieve functions for these two, but no parsers to an array.
There's a TODO out on the SVN. For those that are interested in the project but don't want to wade into SourceForge, the current plan calls for: - Release 0.21, stabilized point-release to make the current API usable - Release 0.30, add all known API functions, add quickget functions, possibly release the test / sample code I am using. - Release 0.31, add eve-central market API - Release 0.32, add a bunch of "utility functions" so you don't have to re-invent the wheel. This is where input will be most welcome. I have things in mind like setcharid(charname), getWalletTransactionsByType(reftype as String), getWalletJournalByType(reftype as String), getCorpMemberDetails(charname) - I'm sure you can think of more. Market functions? Transactions by date or by recipient / sender? What's commonly needed? This'll be your chance to get that utility function in there. - Release 0.40, add a view into the static data export. Kinda hazy on this at the moment. - Release 0.41, utility functions for static data export? Even hazier on that part.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.05 14:02:00 -
[79]
eve-apiphp 0.21 has been released
Release 0.21 stabilizes the 0.20 release that Kw4h created in 2007. Caching is now functional, and some parsing errors have been resolved. All classes and functions follow a common naming convention, and more parameter checks have been added. Code that has been built with 0.20 naming conventions is still expected to work. As always, if you find any issues, speak up.
|

deadmeet
|
Posted - 2008.07.11 19:45:00 -
[80]
Hi,
I could retrieve all characters informations with 0.20 version and now, with 0.21 I get some errors on the first request : charselect.
I trace the problem a little and the $contents variable return nothing in class.api.php line 584, don't know why.
|

deadmeet
|
Posted - 2008.07.11 21:15:00 -
[81]
Hi again,
I found the origin of the problem, this is the
$poststring = http_build_query($params); that didn't work properly.
There is a pretty easy and maybe more universal way to do the same thing :
$poststring = '';
foreach($params as $key => $param) { $poststring .= $key.'='.$param.'&'; }
it do the same job and work correctly on my localhost.
In addition, I made some function to retrieve missing API informations ATM, one to retrieve the assets list, one to retrieve the market orders.
However, they need a review, and the assets system still need some work. Because the code should assume there is no real limit in the asset depth, but I have some difficulties to build the returning array taking care of an indinite depth. So, ATM, it assume level 2 depth (list containers, and item in them only, but it's a good begining ;)).
I added them in the wiki
|

deadmeet
|
Posted - 2008.07.11 21:34:00 -
[82]
Hi,
I would add that there is a little problem with the assets retrieve and the new caching system. If I make a loop to get the assets of all character of an account, it get the assets of the first character only if I enable caching. If I disable it, it work properly.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.15 12:58:00 -
[83]
Deadmeet, thank you. That's interesting - I suppose that function isn't available on all servers, then, or something along those lines? I'll incorporate your suggestion to be sure. I want the API library to work on as many servers as possible. Note I didn't change that part of the code - maybe your server changed since 0.20? It's always used the http_build_query function.
Update on where this project is at, BTW. After many fruitful discussions with Lumy (Thanks, man, I owe you!), I have decided to break from kw4h's vision. The procedural "PHP5-but-really-PHP4" approach he is taking is limited, it does not scale well to extending the class, and it doesn't scale at all to supporting a test server API, chinese API (maybe, no promises), or eve-central API. So, the code framework will be ripped out and replaced. Data structures will remain intact, but the way the API is called will change. More on that as work progresses. I'll likely create a new thread for it once there's something to show.
The TL;DR quick-summary: v0.21 is considered a stable point-release of kw4h's effort. v0.30 will change the code structure, will change the calling conventions, but leave the data structure alone. v0.30 will require you to change the code that calls the API, but the code that works on the results can stay the same.
Trust me, this is for the best. A suggested direction for v0.21, given that it is so procedural, would be for someone, anyone, to take it over and fork it into a PHP4 project. v0.30 will be firmly, very firmly, PHP5.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.16 11:34:00 -
[84]
deadmeet, do me a favor? Try this:
$poststring = http_build_query($params,'','&');
I just tried running my code on XAMPP and for reasons known only to the developers of that package, they set arg_separator.output to "&", instead of the default "&", which makes the EvE API server very unhappy. Some hosting providers do the same.
And let me know whether that resolves your issue, please.
|

deadmeet
|
Posted - 2008.07.16 16:53:00 -
[85]
Hi,
It seems to work like a charm, on a localhost wamp server ;)
I'm playing with the new version of API you provided on the wiki, great job !!
I can't wait to play with the missing stuff like assets listing ;)
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.17 02:40:00 -
[86]
Wow, this is an annoyingly common problem - my corp just got bitten by it, too. The workaround code I gave you only works with PHP 5.2.x. For 5.0/5.1, you'd call this before http_build_query:
ini_set('arg_separator.output','&');
I thought anything before 5.2.x was well and truly done for, but I guess not. Shucks. And here I was going to use all kinds of nifty 5.2 features, too - guess not, then.
|

deadmeet
|
Posted - 2008.07.17 11:51:00 -
[87]
Hi,
Yes, I have php 5.2 on my localhost, so your previous suggestion worked well.
What about my solution ? maybe it's not the most "optimised", but I think it will work on most platform as it's only concatenation of strings.
|

Lumy
Minmatar Templars of Space
|
Posted - 2008.07.17 16:13:00 -
[88]
Originally by: deadmeet Hi,
Yes, I have php 5.2 on my localhost, so your previous suggestion worked well.
What about my solution ? maybe it's not the most "optimised", but I think it will work on most platform as it's only concatenation of strings.
You should use http_build_query because it automatically encode special characters like space, percent signs, etc. For example /eve/CharacterID.xml.aspx can contain them.
Joomla! in EVE - IGB compatible CMS. |

Rynlam
|
Posted - 2008.07.17 17:16:00 -
[89]
Nice to see someone has picked this up. I'll have to look at the updated stuff... I had moved everything into a single class using cURL and have been using that with no problems for a while. I much prefer a monolithic class over having to call a static function by name every time I want to get API data... getCharInfo() then CharInfo::getCharInfo() is just stupidly redundant and wasteful IMNSHO...
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.18 17:33:00 -
[90]
Hey Rynlam, welcome to the project! I hope we can pull you over to the dark side - I really don't want a monolithic class, but I agree that the one-two-punch is highly annoying. That's going to go out the window and no mistake.
On the http_build_query(), what Lumy said. It can get a bit more involved than just that simple concat.
0.22 is in testing right now, it fixes the http_build_query() issue and has improved caching, once more - it will now obey CCP's cachedUntil hint if no explicit timeout is given, with the exception of the wallet functions, where cachedUntil is broken. Bad CCP, only a soggy cookie.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.07.19 11:46:00 -
[91]
Originally by: Kanmahr Hello, wondering you can help
After a few retrievals (cached or not) the getSkillTree call throws the following error:
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 5492: parser error : out of memory error in /php/api/class.api.php on line 273
It's the first thing I call in my file. Anyone else have issues with this?
I think I found that particular one. isCached and retrieveXML both use large variables that hold the entire text that you fetched. PHP does not release memory for these on function exit. So, now I am calling unset() on these. I am running some more tests, and then 0.22 will be released. I'd be grateful if you could test your usecase against 0.22 - let me shoot you an EM, maybe you could even test before release to confirm the bug's been nailed.
|

Lifigaana Becar
ICE is Coming to EVE
|
Posted - 2008.08.15 12:45:00 -
[92]
my contribution :
File class.api.php
public function getAssetsList() { $contents = $this->retrieveXml("/char/AssetList.xml.aspx");
return $contents; }
File class.assetslist.php
<?php /************************************************************************** PHP Api Lib Copyright (C) 2007 Kw4h
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ class AssetsList { static function getAssetsList($contents) { if (!empty($contents)) { $output = array(); $xml = new SimpleXMLElement($contents);
// add all assets items in an array foreach ($xml->result->rowset->row as $row) { $index = count($output); foreach ($row->attributes() as $name => $value) { $output[$index][(string) $name] = (string) $value; } }
return $output; }
return null; } } ?>
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.08.17 15:58:00 -
[93]
Thank you! I actually already have an assetsList contribution, which is waiting with a few other things to be tested before 0.22 can be released. I'll take a look at your code and see whether it improves on what's been contributed.
If you'd like to see where the code is at currently, please feel free to get trunk/ from SVN - that's usually reasonably stable, has a TODO that lists things that aren't fully tested yet, and has the contributions I received.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.08.20 14:56:00 -
[94]
Version 0.22 has been released. You can grab it from the SourceForge project page. New API functions, new license, fixed some memory bugs and that pesky amp bug.
Here's the CHANGELOG:
- The library has moved to the LGPLv3 instead of the GPLv3. This means you are now free to use the library, and you do not have to GPLv3 the code that uses the library. If you make changes to the library, you do have to release those changes back to the public, even if you do not distribute your copy of the library but only use it to offer services through a web host. I feel that LGPLv3 gives much greater freedom all around to everyone - I get your changes to the library back, which I want; and you are free to use the library in a closed alliance tool if you so desire. - Added getAssetList and getIndustryJobs functions, donated by Dustin Tinklin - Several users have run into issues with http_build_query using '& amp;' as a separator instead of '&' in their environment. Added some code to retrieveXML that will force it to be '&', and then reset it back to what it was. The alternative to use the 5.2 syntax of http_build_query was considered and rejected on the discovery that 5.1 and even 5.0 are still very common "out there" - Removed the $cachethis parameters again, across the board - Lumy is right, that was a bad idea. Please use the api->cache() function to control caching behavior - Changed the default caching behavior. Things will be kept in cache for the period of time that CCP specifies, unless this is overridden with the optional "timeout" parameter on the get* functions. Note that this library does not save you from shooting yourself in the foot - if you set timeout to a lower time than the caching value specified by CCP, the API may return errors on subsequent attempts to fetch data. - With the exception of wallet data, which has a cachedUntil of 15 minutes, but returns API errors because it really only wants to be called every 60. Setting it to 65 to be safe. See also http://oldforums.eveonline.com/?a=topic&threadID=802053. - And added an extra 5 minutes leeway (default) into the cachedUntil and $timeout logic, to give the CCP server and your server a chance to be "off" a little on time. - api->setTimeTolerance() can be used to adjust the above leeway. - Fixed a bug where $params would not be reset correctly if it was not an array - Added manual garbage collection to isCached and retrieveXml as well as parsing functions so that PHP won't run out of memory so quickly
|

Relyen
Caldari Dead Flesh Corp Rigor Mortis Mortalis
|
Posted - 2008.09.24 14:46:00 -
[95]
Was just reviewing this library as a reference to something I am planning to work on and noticed a small code bug. Not a PHP expert, so feel free to correct me. :P
in class.api.php -- lines 229-230
// Presumably, if it's not set to '&', they might have had a reason for that - be a good citizen $sep = ini_get('arg_separator.output');
And then in class.api.php -- lines 238-239
// And set it back to whatever sensical or non-sensical value it was in the 1st place ini_set('arg_separator.output','&');
I'm guessing that line 239 was supposed to be
ini_set('arg_separator.output', $sep);
________________________________
I am own. |

Eldstrom
|
Posted - 2008.09.24 16:44:00 -
[96]
Edited by: Eldstrom on 24/09/2008 16:46:49 looks like you could be right there.
Corrected it in current working branch.
Eld
|

Relyen
Caldari Dead Flesh Corp Rigor Mortis Mortalis
|
Posted - 2008.09.25 18:29:00 -
[97]
Edited by: Relyen on 25/09/2008 18:35:33 As I mentioned before, I was interested in this api and was going to use it as a reference for something I would be working on. So, with that in mind I basically rewrote it to fit a bit more of my style.
I am posting here for a review of it, not really a release, just curious if I'm heading in the right direction or am totally f'd up :P They are of course, not totally done, but they work :)
I reused several chunks of code (didn't feel like reinventing the wheel) but I rearranged them, altered the style a bit, added more documentation and gave it some more core objects.
In the main api file, I removed the Debug and Cache code and moved each to their own objects. Also, I gave the debug object a level's option. Also, I removed the various API specific retrieve functions, instead I am going to move those into the associated classes.
As I don't think the api needs to know how each specific API needs to be called. It should be able to handle any call, but the specifics should be known to the associated objects themselves.
Atm, I am creating the API in the test file, and passing it as a reference to the specifc api class (I only have 1 atm for testing). It doesn't do much, but just tests the retrieval of the corp security logs.
I plan on adding smarty Templates in the future, and then fleshing out the individual API classes more.
Just curious what people think. I tossed in the LGPL from the eveapi v0.22 of this thread (as that is where I got a lot of the code), but I didn't include any copyright notes in any of the files, not even for myself. I was just doing this for my corp and am interested in feedback. I really don't know how all the licenses work, so just stating where I got alot of code chunks from. I may rewrite more as I advance in my progress and find my needs change.
You can check out the files Here
________________________________
I am own. |

Eldstrom
|
Posted - 2008.09.29 10:58:00 -
[98]
So Far .2x has only been bug fixes and increased eveapi support to Kw4h orignal, however I know Yorick Downe has plans for a rewrite for version .50 . It sounds like your thoughts on are along the samelines as his, Might be an idea if you talk to him about it.
Eld
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.10.02 10:43:00 -
[99]
Relyen, Eldstrom's right. The 0.2x effort has been to make what's there now more complete. I agree that the overall structure of the library is convoluted, that it should be able to generic-parse just about anything the API throws at it without knowing the specifics of every call, and that debug levels, exception handling, and such are needed. Also, the api class should be more generic, so that it can be used for TQ, Sisi, China, EvE-Central, etc.
I haven't gotten past the "thinking about it" stages. Thank you for sharing your code. Once the current 0.23 effort is out the door, I'll go take a closer look. If you'd like to be a direct part of the 0.50 rewrite effort, let me know by EM, and we'll get you set up as a dev for this project on SourceForge.
|

Malice Shecktily
|
Posted - 2008.10.11 23:09:00 -
[100]
here's a little addition to get a character's market orders (seems to be missing from this version -and I can't remember now whether I wrote this myself (been ages since I last looked at this) or whether I pciked it up from another post somewhere - so if someone other than me wrote it then please jump up and claim the credit!)):-
file class.api.php:- add... public function getMarketOrders($corp = false) { $params = array();
$content = null; if ($corp == true) { $contents = $this->retrieveXml("/corp/MarketOrders.xml.aspx ", $params); } else { $contents = $this->retrieveXml("/char/MarketOrders.xml.aspx ", $params); }
return $contents; }
file class.mktorders.php:-
<?php /************************************************************************** PHP Api Lib AccountBalance Class Portions Copyright (C) 2007 Kw4h Portions Copyright (c) 2008 Thorsten Behrens
This file is part of PHP Api Lib.
PHP Api Lib is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
PHP Api Lib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with PHP Api Lib. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ class MarketOrders { static function getMarketOrders($contents) { if (!empty($contents)) { $output = array(); $xml = new SimpleXMLElement($contents);
// add all transaction items in an array foreach ($xml->result->rowset->row as $row) { $index = count($output); foreach ($row->attributes() as $name => $value) { $output[$index][(string) $name] = (string) $value; } }
return $output; }
return null; } } ?>
Keep up the good work folks - This is good stuff, I've been devving in php for a while but am just starting with OOP (so scary!) so this is useful learning stuff for me - Thank you all!
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.10.12 14:18:00 -
[101]
Thank you. We actually have every single last API function in CVS right now - yes, including portraits and even eve-central, all thanks to Eldstrom's heroic efforts - but it needs testing. That's my job, and I haven't gotten to it, mainly due to a) work and b) playing Sacred.
We'll get there. There'll be a 0.23, which will be API-complete.
|

Malice Shecktily
|
Posted - 2008.10.28 00:10:00 -
[102]
Originally by: Yorick Downe
We'll get there. There'll be a 0.23, which will be API-complete.
Looking forward to it - doing some stuff of my own - db abs class to handle MySql stuff etc (I'm a data horder and trader in-game ... so needed the market orders asap)
One idea that's occurred to me is that the Api might benefit from a getCacheDateTime function so a decision can me made from the app as to what to do next with either cache or live data (namely update the db or not) - I'm working on that myself but being new to oop it's going uncertainly - am I re-inventing the wheel? at present I'm setting a property in isCached and using a getChacheTime public function within the class to retrieve the value, but , being new to oop I'm not at all sure that would be considered "best practice" - how would others approach this? - I get the feeling there's a few posting here who know a thing or two!
Should be interesting to see what people's final results are from the api work. The eve-central stuff sounds interesting too.
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2008.10.28 01:03:00 -
[103]
Excellent. I'd love to run the 0.5 design by you when (and if :) it materializes. The idea was to return an object that has properties such as "fromCache" and so on, so that one knows whether the returned data is new or old cached stuff.
|

Alesk Remo
Amarr Corpus Prometheus
|
Posted - 2008.12.01 07:32:00 -
[104]
Edited by: Alesk Remo on 01/12/2008 07:33:11 First of all - thanks for a really nice class.
Secondly, I've made some modifications to make the cache MySQL dependent (as a choice). However, all this change does is store the XML data into a database table for easy and fast access.
The database requirements: The database requires a single table, api_cache, which has three columns, CacheID, CacheLocation and CacheValue.
CacheID is an indexed Primary Key field which I use in order to speed up requests to the cache table.
CacheLocation stores a unique path like structure similarly to that which is currently used as the path that is created by the getCacheFile function. In fact it uses the same function except it replaces the "/" slashes with "-" hyphens.
CacheValue stores the XML data in an HTML encoded format (using the htmlentities function) which has been fetched by the API class.
Quote:
CREATE TABLE `api_cache` ( `CacheID` int(11) NOT NULL auto_increment, `CacheLocation` longtext character set latin1, `CacheValue` longtext character set latin1, PRIMARY KEY (`CacheID`), FULLTEXT KEY `CacheLocation` (`CacheLocation`,`CacheValue`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
The code changes: The only file affected with the changes is the class.api.php file.
The code changes only affect those function which access and write/update the cache. Static variables are also created along with a property function to specify the database parameters.
There is a fair amount of changes to the function which would take about 5 replies. To simplify this I've linked to the modified file so that you can download and have a look at the code.
Linkage
I have no doubt that there are better ways to use a database with this class, however these modification basically just replace the use of the directory store as a cache with a database store. All XML is encoded when stored and then decoded again when accessed.
I would like to hear opinions and feedback on this as well as if anyone has any ideas to improve on this.
Regards,
Alesk Remo
|

Eldstrom
|
Posted - 2008.12.03 11:36:00 -
[105]
I am assuming your alteration is to the 0.22 Version and not the upcoming 0.23 very which covers the whole API that is currently available?
Eld
|

Alezra
Di-Tron Heavy Industries Atlas Alliance
|
Posted - 2008.12.05 03:38:00 -
[106]
I built a framework for a similar API interface and I'm guessing it operates in a similar fashion to Relyen's. The whole thing is broken out into different objects (perhaps even excessively.) The base class is apiConnection. Its only purpose is to connect to the API using the supplied arguments and handle caching data.
The individual data classes are supplied with a reference to an apiConnection object which they use to fetch xml.
An example of my api in action:
$myAccount = new apiConnection($userID, $apiKey); $myData = new apiData();
$myData->char->SkillInTraining->fetch($myAccount, $characterID); $xml = $myData->char->SkillInTraining->getRawXML();
It can generically retrieve the xml for any api call at the moment. The next part of implementation would be to cause the data fetch() method to parse the xml into usable content. I realized that I could literally copy the code out of your parsing functions directly into my data objects. I'm still debating if I want to do that or write my own xml parsing.
The constructor for the apiConnection class looks like this:
public function __construct ($id = 0, $key = 0, $setCaching = TRUE, $dir = "xmlcache/", $rootAddress = "http://api.eve-online.com")
If caching is enabled (which it is, by default) then all data retrieved from the api is stored under
xmlcache/$userID/$characterID/
A call to flushCache() will delete that data, and a fetch command with the flag FLUSH_CACHE will force the apiConnection to query the server again.
|

Kyara
Gallente Tides of Silence KIA Alliance
|
Posted - 2008.12.09 14:28:00 -
[107]
I've been using this API for a private Project of mine, so i might aswell make the code to it public.
Page with Download and Instructions: http://trac.beerta.net/trac/EveTool/ Screenshots: http://files.beerta.net/gallery/EveTool/
Maybe somebody has use for it.
Patches with new stuff welcome!
|

Lumy
Minmatar eXceed Inc. Triumvirate.
|
Posted - 2008.12.09 15:13:00 -
[108]
Originally by: Alezra the long post
Could you provide link to SVN or source code? Maybe I could steal something useful from you. 
Joomla! in EVE - IGB compatible CMS. |

Alezra
Di-Tron Heavy Industries Atlas Alliance
|
Posted - 2008.12.10 03:11:00 -
[109]
Ehrm, well I was planning on releasing it eventually, but to be honest at the moment it isn't terribly impressive. I have about 55 lines of useful code that handle the apiConnection->fetch() and caching and then 600 lines of code that do nothing but build empty data handlers. As an example, for each API call there's a class like this:
class skillTrainingData extends genericData { public function __construct($url) { parent::__construct($url); } }
Eventually I want to add an xml parser and accessors to each of these class definitions, but it's a bit daunting. At the moment the only thing each data object does is construct, fetch and getRawXML (which are all members of genericData.)
My strategy would be to do something like have an abstract function parse() in each data member that's called when fetch() is ran. The parse command for SkillTrainingData runs an xml parser and stores the results in public variables. Then the user can call something like
$myData->char->SkillInTraining->fetch(); $currentSkill = $myData->char->SkillInTraining->typeID; $nextLevel = $myData->char->SkillInTraining->trainingToLevel;
|

Dan Treva
Raptor Services LTD
|
Posted - 2008.12.12 02:51:00 -
[110]
Originally by: Kyara I've been using this API for a private Project of mine, so i might aswell make the code to it public.
Page with Download and Instructions: http://trac.beerta.net/trac/EveTool/ Screenshots: http://files.beerta.net/gallery/EveTool/
Maybe somebody has use for it.
Patches with new stuff welcome!
You should start your own thread for this.
It definitely had some promise.
I gave it a whirl, and there are a few bugs... looks like some is static db calls and a few missing calls.
|

Alesk Remo
Amarr Corpus Prometheus
|
Posted - 2008.12.23 12:27:00 -
[111]
Quote: I am assuming your alteration is to the 0.22 Version and not the upcoming 0.23 very which covers the whole API that is currently available?
Eld
@Eldstrom:
You are correct, my alteration is to the 0.22 version. I was unaware of the 0.23 version at the time of development. I have now moved my code over to the 0.23 version which is available here:
Linkage
This might not be the best way to handle it but I'm open to any suggestions further. I've tried to keep it quite simple.
Any feedback welcome.
Regards,
Alesk Remo
--- ---
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2009.01.05 12:47:00 -
[112]
Edited by: Yorick Downe on 05/01/2009 12:48:29 Hiya, figured I'd pipe up after a long silence. Lumy's been, as he said, reworking the library in a Herculean effort. I've been mostly slacking, but have recently come out of my slumber to do QA on Eldstrom's 0.23 effort. As a result, we now have a 0.23 that works, encompasses all EvE-API calls and EvE-Central calls, and is ready for testing.
I'd like to ask those who wish to use the library to give it a good spanking. Particularly the new functions, such as the Faction code, has only been tested against XML dumps we got from the forums, as we have no characters that are part of a Faction. The EvE-Central output can also use a good looking-at. Check the samples directory to see how this all works while documentation is being updated, please.
The current 0.23 trunk lives here: http://eve-apiphp.svn.sourceforge.net/viewvc/eve-apiphp/trunk/
There are two TODOs on my plate right now - update the documentation, and handle SimpleXML exceptions when EvE-Central goes down (as it does frequently).
Happy New Year!
|

Buzz AU
|
Posted - 2009.01.13 17:22:00 -
[113]
Hey guys,
Nice work on this, I am a little confused with this as I dont use / havnt used XML. I am looking to use this script to check for payments into my player account and want to make use of the following fields from the output of WalletJournal:
Quote: [ownerName2] = $mychar [amount] = '10000000.00' [reason] = 'free monies'
[date] = Output this [ownerName1] = Output this
So what I want to display is the name of the person sending the above "gift" to a set character (me). In the end this information will be stored into a SQL database, which will essentialy add time to a service that I offer upon reciept of the payment.
Any help would be greatly appriciated.
This is the code I have but it just spews out a lot of transactions.
Quote:
<?php
require_once('eveapi/class.api.php'); require_once('eveapi/class.charselect.php'); require_once('eveapi/class.walletjournal.php');
$apiuser = 'XXXXXX'; // User ID $apipass = 'XXXXXX'; // API Key full $mychar = 'My Name'; // Name of the character $apichar = 'XXXXXX'; // The ID of the character
$api = new Api(); $api->debug(true);// enable debugging $api->setCredentials($apiuser,$apipass,$apichar); $apicharsxml = $api->getCharacters(); $apichars = Characters::getCharacters($apicharsxml);
$api->setCredentials($apiuser,$apipass,$apichar); $walletxml = $api->getWalletJournal(); $wallet = WalletJournal::getWalletJournal($walletxml);
print_r($wallet);
?>
|

Johnathan Roark
Caldari Quantum Industries RAZOR Alliance
|
Posted - 2009.01.13 20:00:00 -
[114]
Originally by: Buzz AU Hey guys,
Nice work on this, I am a little confused with this as I dont use / havnt used XML. I am looking to use this script to check for payments into my player account and want to make use of the following fields from the output of WalletJournal:
Quote: [ownerName2] = $mychar [amount] = '10000000.00' [reason] = 'free monies'
[date] = Output this [ownerName1] = Output this
So what I want to display is the name of the person sending the above "gift" to a set character (me). In the end this information will be stored into a SQL database, which will essentialy add time to a service that I offer upon reciept of the payment.
Any help would be greatly appriciated.
This is the code I have but it just spews out a lot of transactions.
Quote:
<?php
require_once('eveapi/class.api.php'); require_once('eveapi/class.charselect.php'); require_once('eveapi/class.walletjournal.php');
$apiuser = 'XXXXXX'; // User ID $apipass = 'XXXXXX'; // API Key full $mychar = 'My Name'; // Name of the character $apichar = 'XXXXXX'; // The ID of the character
$api = new Api(); $api->debug(true);// enable debugging $api->setCredentials($apiuser,$apipass,$apichar); $apicharsxml = $api->getCharacters(); $apichars = Characters::getCharacters($apicharsxml);
$api->setCredentials($apiuser,$apipass,$apichar); $walletxml = $api->getWalletJournal(); $wallet = WalletJournal::getWalletJournal($walletxml);
print_r($wallet);
?>
All this class does is fetch the api data and dumps it into an array. You would have to go through the array probably using a foreach to put it in an a database. You may be better off using YAPEALif you'd like to go direct to database. |

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2009.01.16 01:24:00 -
[115]
Originally by: Buzz AU
I am looking to use this script to check for payments into my player account and want to make use of the following fields from the output of WalletJournal:
[ownerName2] = $mychar [amount] = '10000000.00' [reason] = 'free monies'
[date] = Output this [ownerName1] = Output this
So what I want to display is the name of the person sending the above "gift" to a set character (me). In the end this information will be stored into a SQL database, which will essentialy add time to a service that I offer upon reciept of the payment.
That very same application is actually sample code in the "sample" directory. Look for "WalletJournal" in the code, you'll see a section there that steps through looking for specific "refTypeID"s. Just before that is the code that grabs the right ID for "Player Donation". So what you want to do is adapt that sample code to your situation. I think you are looking for player donations as well, so it should fit into your situation with a minimum amount of tweaking. The sample code fetches corp, not char (that's the second "true" parameter), which is easily enough changed.
MySQL output is something that has been added to the code, see the posts above yours. It's not (yet) an official part of the library - the team is convinced that we need to redesign/refactor the way the library works in order to make it do all the things we want it to do, and that takes -- long.
"yapeal" is an option, it'll dump the entire WalletJournal into a DB, for you to query on refTypeID or any other criteria. Not a bad approach, though it is the "rival" library. 
Yorick
|

Yorick Downe
Caldari Agony Unleashed Agony Empire
|
Posted - 2009.01.24 02:00:00 -
[116]
0.23 has been released. In celebration, the project has been renamed, and has it's own thread.
I'll probably continue monitoring this one just for the heck of it, but you'll get better results over in the new digs.
|

Wraas Mlnir
Arctic Flying Penguins A.X.I.S
|
Posted - 2009.03.19 13:24:00 -
[117]
COuld someone either provide an expanded explanation of the Getting Started notes that talk about inserting rows into the tables: utilRegisteredUser, utilRegisteredCharacter & utilRegisteredCorporation or point me in the direction of some documentation or even a post in this thread that I missed?
I am having problems and it appears as though I am either putting in too much (is it updated with data as part of its first pass at the API) or I am not putting in something important.
Thanks
-Farting on exiting elevators since 2003 |

Dragonaire
Caldari Corax.
|
Posted - 2009.03.19 14:06:00 -
[118]
I'm guessing you looking maybe for the Yapeal thread? I don't think they use any tables like that in this library except if they have made some changes I haven't seen ;)
Yapeal thread is Yapeal PHP API Library -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
| |
|
| Pages: 1 2 3 4 :: [one page] |