| 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 ... 
|
| |
|
| Pages: [1] 2 3 4 :: one page |
| First page | Previous page | Next page | Last page |