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

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

EVE Technology Lab

 
  • Topic is locked indefinitely.
12Next page
 

PHP Api Library for EVE - ALE 0.6

First post
Author
Lumy
Sebiestor Tribe
Minmatar Republic
#1 - 2011-10-01 16:29:03 UTC
Hi guys and girls

I'm going to keep this short. It's hard to type with one hand broken. ;) So:

New 0.6 release with
- New customizable api keys: See setKey or setKeyID, setVerificationCode, setCharacterID methods
- PDO cache

http://code-box.sk/software/ale.html - Page with some docs. Not updated yet.
http://code.google.com/p/eve-ale/ - New project home. Also downloads.
http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1042213 - Old eveo thread.
http://wiki.eveonline.com/en/wiki/Ale - Eve wiki page (not really relevant).
Zaine Maltis
Innsmouth Enterprises
#2 - 2011-10-01 17:24:05 UTC  |  Edited by: Zaine Maltis
Cracking. I'll get my stuff upgraded.

I don't supposed you saw this did you?

http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1573543
Lumy
Sebiestor Tribe
Minmatar Republic
#3 - 2011-10-01 17:55:29 UTC
Yeah, I missed that one. I see where is the problem now: I never assumed key="eventID, characterID" could have two columns.

Will fix. BRB.
Essence uk
#4 - 2011-10-01 22:41:05 UTC
I have your ALE library from ages ago, it had a class folder with classes for character, corp, assets etc, what happened to this in the new updates ?

Yes, they are modelled on real life ;)

Lumy
Sebiestor Tribe
Minmatar Republic
#5 - 2011-10-02 06:42:33 UTC
You mean files from original kw4h's library? Those were removed ~2.5 years ago.
Lumy
Sebiestor Tribe
Minmatar Republic
#6 - 2011-10-02 08:14:17 UTC
Zaine Maltis wrote:
Cracking. I'll get my stuff upgraded.

I don't supposed you saw this did you?

http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1573543


Fixed. You can get attendees using one of following
Quote:

foreach ($parser->result->eventAttendees as $evenID => $attendees) {
....foreach ($attendees as $characterID => $attendee) {
........//do stuff here
....}
}

foreach ($parser->result->eventAttendees->children() as $attendee) {
....//do stuff here
}

Zaine Maltis
Innsmouth Enterprises
#7 - 2011-10-02 12:02:13 UTC
Excellent. I'll have a look.
Essence uk
#8 - 2011-10-02 13:01:39 UTC
Lumy wrote:
You mean files from original kw4h's library? Those were removed ~2.5 years ago.


But why, from what I can see they are functional and still relevant / working ?

Yes, they are modelled on real life ;)

Lumy
Sebiestor Tribe
Minmatar Republic
#9 - 2011-10-02 13:30:04 UTC
Essence uk wrote:
Lumy wrote:
You mean files from original kw4h's library? Those were removed ~2.5 years ago.


But why, from what I can see they are functional and still relevant / working ?

I knew I would be too lazy to update library every time CCP added new or changed existing api function. Universal "parser" is much easier to maintain. Also old class was very limiting in terms of querying (no https) and caching (only as files).

Btw, have you really not noticed the changes during last ~ 2 years?
Essence uk
#10 - 2011-10-02 14:58:11 UTC
Lumy wrote:
Essence uk wrote:
Lumy wrote:
You mean files from original kw4h's library? Those were removed ~2.5 years ago.


But why, from what I can see they are functional and still relevant / working ?

I knew I would be too lazy to update library every time CCP added new or changed existing api function. Universal "parser" is much easier to maintain. Also old class was very limiting in terms of querying (no https) and caching (only as files).

Btw, have you really not noticed the changes during last ~ 2 years?



I've just recently dug out a project that has been dormant for 3 years, I only just updated to the new ALE release. I haven't been keeping track of it at all.

Yes, they are modelled on real life ;)

Zeta Zhul
Preemptive Paranoia
#11 - 2011-10-04 16:52:36 UTC
Hi!

Just started playing around with Ale and got this error message:

[https://api.eveonline.com/account/Characters.xml.aspx] SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

You can bypass this error:

FIx Curl SSL certificate problem

Basically you download the pem file from pem

Then in curl.php you change:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['timeout']);

to:

$ch = curl_init();

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt ($ch, CURLOPT_CAINFO, "cacert.pem");

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['timeout']);

And that fixes the issue. Unless there is a better way in which ignore that I ever wrote anything. Big smile

So far pretty interesting.
Dragonaire
Here there be Dragons
#12 - 2011-10-04 17:04:05 UTC
I've made a custom crt chain just for Eve API in Yapeal which anyone is welcome to use. You can find it in config/eveonline.crt. I made it by exporting the chain from Firefox so it's not hard to do it yourself if you prefer.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Lumy
Sebiestor Tribe
Minmatar Republic
#13 - 2011-10-04 17:10:22 UTC
Thanks both of you. I'll definitely look into it.
Zeta Zhul
Preemptive Paranoia
#14 - 2011-10-04 18:17:43 UTC
Hi!

I'm a bit confused atm. Just running the basic example code for obtaining the charactersheet for 1 character on an account. But I'm getting back the character sheet data for all 3 characters on the account.

$userID = $row->userid;
$apiKey = $row->fullapikey;

$ale = AleFactory::getEVEOnline();
//set user credentials, third parameter $characterID is also possible;
$ale->setCredentials($userID, $apiKey);
//all errors are handled by exceptions
//let's fetch characters first.
$account = $ale->account->Characters();
//print_r( $account );
//you can traverse rowset element with attribute name="characters" as array
foreach ($account->result->characters as $character) {
//this is how you can get attributes of element
$characterID = (string) $character->characterID;
$ale->setCharacterID($char);
$characterSheet = $ale->char->CharacterSheet();
$balance = number_format((string)$characterSheet->result->balance, 2);
var_dump( $characterSheet );

Sorry about the formatting. I figure I must be doing something wrong. But I can't for the life of me figure out what. And when go to get the character wallet balance I get the wallet balance for all 3 characters. Any help would be appreciated.
Lumy
Sebiestor Tribe
Minmatar Republic
#15 - 2011-10-04 18:34:52 UTC
use

$ale->setKey($keID, $vCode); //new CAK
instead of
$ale->setCredentials($userID, $apiKey); //legacy limite/full api keys


$keyinfo = $ale->account->APIKeyInfo ()
instead of
$account = $ale->account->Characters();

check for
$keyinfo->result->key->type == "Character" || $keyinfo->result->key->type == "Account"

and iterate over
$keyinfo->result->key->characters

AND MAKE SURE YOUR KEY IS PROPERLY CONFIGURED! (see devblog for more details)
PsyKzz
Bat Country
Pandemic Horde
#16 - 2011-10-05 01:17:10 UTC
Im actually REALLY glad You brought it back to life,
<3

Meh.

Zeta Zhul
Preemptive Paranoia
#17 - 2011-10-05 02:52:18 UTC  |  Edited by: Zeta Zhul
Hey thanks! Yes that fixed.

Sorry to bug you about something else. But could you point me to where there might be an example of some AssetList code? I need to use the ->children() function in a foreach() right?

Edit: This seems to work ok.

try {
$assetList = $ale->char->AssetList();

foreach( $assetList->result->assets as $asset) {
echo "itemID=".$asset->itemID.",locationID=".$asset->locationID.",typeID=".$asset->typeID.
",quantity=".$asset->quantity.", flag=".$asset->flag.",singleton=".$asset->singleton."";

if(count((array)$asset->children()) > 0) {
echo "contents: ";
foreach((array)$asset->contents->children() as $content) {
echo "...itemID=".$content->itemID.",locationID=".$content->locationID.",typeID=".$content->typeID.
",quantity=".$content->quantity.", flag=".$content->flag.",singleton=".$content->singleton."";
}
}
}
} catch( Exception $e ) {
echo $e->getMessage();
}
Lumy
Sebiestor Tribe
Minmatar Republic
#18 - 2011-10-05 05:05:17 UTC
you don't need to use ->children(), you can do this
foreach($assetList->result->assets as $asset) {
....//do stuff here
....if (isset($asset->contents)) {
........foreach($asset->contents as $content) {
............//do more stuff here
........}
....}
}
Lumy
Sebiestor Tribe
Minmatar Republic
#19 - 2011-10-05 11:57:54 UTC
Again, thanks Dragonaire and Zeta Zhul. New version is up with certificate I borrowed from yapeal.
Minor structure change: moved all *.ini files to config subdirectory.
Zaine Maltis
Innsmouth Enterprises
#20 - 2011-10-05 20:30:23 UTC
Am I being daft? I've got a key with both Private Information->CharacterInfo and Public Information->CharacterInfo selected.

I'm doing:

$ale->setKey($keyid, $vcode);
$ale->setCharacterID($charid);

// try and grab the characters
$charactersheet = $ale->EVE->CharacterInfo();

and I'm getting an "Invalid characterID" error.

If on the same key I change the call to:

$ale->char->CharacterSheet();
or
$ale->char->WalletJournal();

it works fine meaning that the $ale->setCharacterID($charid); call is working correctly... er.. typo I haven't spotted?
12Next page