Pages: [1] 2 3 :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Lumy
Minmatar eXceed Inc. Minor Threat.
|
Posted - 2009.04.04 22:51:00 -
[1]
0.50 RELEASE IS HERE
I'll try to keep this short. We have new release of Ale just for you. Currently marked as 0.5 RC1 (code name: Lumy's revenge) brings you:
- Complete OOP redesign
- Errors handling by exceptions. As God intended.
- Highly configurable. But you don't have to modify library.
- Multiple cache plugins. File system, raw MySQL, ADOdb and more possible.
- Curl or fsock http request plugins. Whatever your hosting supports.
- Easy to use. Just include single file and use factory to build you object by your preference.
- Dynamic API calls. No more waiting for update when CCP release new API.
- Specialized XML parser. Access <rowset> elements by their name and use them as array. And few more neat features.
Note that this is release candidate. Though I'm using it for few of my project, there might be few bugs that need to be eradicated.
Eve-apiphp is currently undergoing rename to eve-ale on sourceforge. If the links get broken, change probably kicked in. I'll be watching and try correct links ASAP.
Links:
Project site
Example code
Documentation
Report bugs here
Need help? Ask here or use this thread.
Enjoy.
Joomla! in EVE - IGB compatible CMS. |
Adrielle Firewalker
Minmatar WASTELAND MINERS Inc.
|
Posted - 2009.04.07 00:54:00 -
[2]
Yay Lumy ================
~Adrielle
Original MinmatarT |
Eons Fairlight
|
Posted - 2009.04.08 18:00:00 -
[3]
Thanks for the library, it took me a while to figure out how to use it tho.
I'm in the process of writing an accounting style webapp and my first step was to get my Wallet Transactions. The example code link above didnt help me that much and was confused by the old style used in eve-apiphp. Here's some example code that will hopefully help out other coders who might encounter the same confusion i did.
This code is rather pointless but it shows syntax for traveling "rowset"s
$ale = AleFactory::getEVEOnline(); $ale->setCredentials($apiuser, $apipass); try { $account = $ale->account->Characters(); foreach ($account->result->characters as $character) { $characterID = (string)$character->characterID; if ($mychar == (string)$character->name) { $ale->setCharacterID($characterID); $characterData = $ale->char->CharacterSheet(); $balance = number_format((string)$characterData->result->balance, 2); } }
$marketData = $ale->char->WalletTransactions();
foreach ($marketData->result->transactions as $transaction){ $time = $transaction->transactionDateTime; $quantity = $transaction->quantity; $itemName = $transaction->typeName; etc...
} } catch (Exception $e){ echo $e->getMessage(); }
Hope this helps someone.
|
Lumy
Minmatar eXceed Inc. Minor Threat.
|
Posted - 2009.04.08 19:38:00 -
[4]
Yep, I suck at writing docs. I have added two more examples:
Get CorporationSheet using corporationID
Nestet <rowset> elements in KillLog
Joomla! in EVE - IGB compatible CMS. |
Tonto Auri
Vhero' Multipurpose Corp
|
Posted - 2009.04.08 21:07:00 -
[5]
Edited by: Tonto Auri on 08/04/2009 21:07:24 Reading through CHANGES... just curious - are you going to have it ready for PHP 5.3? :)
EDIT: phpDocumenter ftw ^_^ -- Thanks CCP for cu |
Lumy
Minmatar eXceed Inc. Minor Threat.
|
Posted - 2009.04.08 21:29:00 -
[6]
Originally by: Tonto Auri Edited by: Tonto Auri on 08/04/2009 21:07:24 Reading through CHANGES... just curious - are you going to have it ready for PHP 5.3? :)
EDIT: phpDocumenter ftw ^_^
Code is E_STRICT, so it should be fine. I don't expect to use any new 5.3 features. Namespaces would break backward compatibility. Every class and constant uses Ale- prefix, so it should be fine in almost all cases. Library doesn't extend any classes with static methods, so no need for late static binding.
I guess (persistent) mysqli cache would be nice. Will have a look at it.
Joomla! in EVE - IGB compatible CMS. |
Syringe
Oedipus Complex
|
Posted - 2009.04.24 20:58:00 -
[7]
I'll be dissecting this thing for my drupal integration. You want me to follow through with documentation? --------- War isn't the answer. However, the objective isn't to provide answers rather than eliminate the question. |
Lumy
Minmatar eXceed Inc. Minor Threat.
|
Posted - 2009.04.24 21:32:00 -
[8]
Originally by: Syringe Edited by: Syringe on 24/04/2009 21:14:43 Thanks for the work on this release - you're a badass Lumy.
I'll be dissecting this thing for my drupal integration. You want me to follow through with documentation?
I hope only thing you'll have to do is to implement Drupal cache. Either implement AleInterfaceCache interface, or extend AleCacheAbstractDB class. Dunno which will suit you better (never coded Drupal extensions).
If you're willing to send final class to me, I'll gladly include it to library. Any contribution is welcome.
Joomla! in EVE - IGB compatible CMS. |
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.04.25 22:42:00 -
[9]
Quick update:
Added new class for EVE Central API. Example:
require_once 'ale/factory.php'; $ale = AleFactory::getEVECentral();
$params = array('typeid'=>array(34,35)); $xml = $ale->marketstat($params);
$params = array('typeid'=>34); $xml = $ale->quicklook($params);
$xml = $ale->evemon();
IMPORTANT: Always use config option "request.flattenParams = true". This will allow you to request multiple itemid-s in single request and more importantly, you won't get 417 server error. Cache time is in seconds from time of last uncached call. Option main.cacheTime. If you don't want to use cache, set cache.class to "Dummy".
Enjoy.
Joomla! in EVE - IGB compatible CMS. |
Iyotaka
Iyotaka Union
|
Posted - 2009.04.26 18:01:00 -
[10]
Edited by: Iyotaka on 26/04/2009 18:07:17 Edited by: Iyotaka on 26/04/2009 18:06:04 Guess I am the first one to follow the "bug" link.
Only textual, and maybe a different naming convention.
As I have not used the old api ever (needed an updated PHP which I know have) I'll be providing feedback as I can, bug or no bug.
Edit: Ran your simple program from the command-line, just to test. In one way, looks promising, but do I have to recompile (will require lots of work) to get curl, or is there a way around using curl - e.g. a different call. I recall reading for the old versions of eveapi that there were also "curl-less" versions.
<font color=ff0000> Fatal error: Uncaught exception 'LogicException' with message 'Curl extension is missing' in /htdocs/eveapi/ale/request/curl.php:38 Stack trace: #0 /htdocs/eveapi/ale/factory.php(138): AleRequestCurl->__construct(Array) #1 /htdocs/eveapi/ale/factory.php(158): AleFactory::init('EVEOnline', Array) #2 /htdocs/eveapi/ale/factory.php(187): AleFactory::get('EVEOnline', Array, false) #3 /htdocs/eveapi/ale/simple_ale(5): AleFactory::getEVEOnline() #4 {main} thrown in /htdocs/eveapi/ale/request/curl.php on line 38 </font>
|
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.04.26 20:01:00 -
[11]
Edited by: Lumy on 26/04/2009 20:03:06 That's why do we have multiple http request connectors here ;)
Just go to eveonline.ini and set
[request] class= "Fsock"
or you can pass override in config array
$config = array('request.class' => 'Fsock'); $ale = AleFactory::getEVEOnline($config);
edit: or you can try to install curl
Joomla! in EVE - IGB compatible CMS. |
Iyotaka
Iyotaka Union
|
Posted - 2009.04.26 20:26:00 -
[12]
Edited by: Iyotaka on 26/04/2009 20:37:44 Edited by: Iyotaka on 26/04/2009 20:34:14 very nice. I'll try that.
p.s. sent an ingame message - basically, if I have the time, I'll test and maybe work on documentation.
Edit: speaking of documentation - simple program returns:
Table 'ale.alecache' doesn't exist
I thought enough to create the user and the database, but without installation documentation (only one line in the wiki - unpack the zip file) no idea what the tables should look like.
I'll check for a sql file (now) - but here I stumbled.
edit2: found directory sql, and used the file there to create the database. Running from the command line, the simple program does not generate any output. So, I"ll work on a new sort of "Hello World" simple program to test if it is up and runnable.
|
Hiro Kator
|
Posted - 2009.05.06 13:24:00 -
[13]
Edited by: Hiro Kator on 06/05/2009 13:25:08 Hello,
and thanks for the library. It was a bit tricky to get it working, but it does now.
I don't mean to sound stupid, but I have no idea how the thing works. What I do not understand is how you can make a call like this:
$ale = AleFactory::getEVECentral();
$params = array('typeid'=>array(34,35)); $xml = $ale->marketstat($params);
When, in my humble opinion, marketstat-function is nowhere to be defined in the class AleEVECentral (which is defined the file evecentral.php).
Could someone give me a simple example, which fetches the given characters assets (using extended api key) and prints them?
I will probably use ALE through HAXE anyway, so it's not that important that I get the lib 100%.
Thank you in advance.
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.05.06 14:01:00 -
[14]
Both AleEVEOnline and AleEVECentral generates methods dynamically. Example: http://api.eveonline.com/example/call.xml.aspx translates to $eo_ale->example->call(); http://api.eve-central.com/api/examplecall translates to $ec_ale->examplecall();
For all available calls see documentation at EVE Central and EVE Development Network
There is one more complicated example here: http://sourceforge.net/docman/display_doc.php?docid=174933&group_id=233060. It's for KillLog, but I hope you'll get an idea. When in doubt, you can always transform result to array using $xml->toArray() (works only for EVE Online).
Hope it helps.
Joomla! in EVE - IGB compatible CMS. |
Iyotaka
Iyotaka Union
|
Posted - 2009.05.15 06:45:00 -
[15]
Edited by: Iyotaka on 15/05/2009 06:47:50 Just curious. Doing a lot of examination or research as to hall the code works. I have been looking through the code and must learn how all those __construct functions work. That must be how you are translating all the "undefined" methods.
And now a question, and a request.
The program is called as: ./IY.php >IY.txt
The first time I run the program (or cache has expired) the following code snippet
Quote:
$account = $ale->account->Characters(); print_r($account);
Starts out with the SQL code (e.g.)
Quote:
INSERT INTO alecache (content, cachedUntil, host, path, params) VALUES ('<?xml version=\'1.0\' encoding=\'UTF-8\'?>\r\n<eveapi version=\"2\">\r\n <currentTime>2009-05 -15 06:06:37</currentTime>\r\n <result>\r\n <rowset name=\"characters\" key=\"characterID\" columns=\"name,characterID,corporationName,corporationID\">\r\n <r ow name=\"Iyotaka\" characterID=\"684446508\" corporationName=\"Iyotaka Union\" corporationID=\"1201989246\" />\r\n .... snip ....
and then starts with what I expected:
Quote:
AleParserXMLElement Object ( [name:private] => eveapi [data:private] => SimpleXMLElement Object ... snip ...
And it does the same for the following code - which amazes me even more!
Quote:
//you can traverse <rowset> element with attribute name="characters" as array echo "name/characterID corp/corpID\n"; foreach ($account->result->characters as $character) { //this is how you can get attributes of element $characterID = (string) $character->characterID; $name = (string) $character->name; $corpID = (string) $character->corporationID; $corpName = (string) $character->corporationName; echo "$name/$characterID $corpName/$corpID\n"; //set characterID for CharacterSheet $ale->setCharacterID($characterID); $characterSheet = $ale->char->CharacterSheet(); // print_r($characterSheet);
Quote:
name/characterID corp/corpID Iyotaka/684446508 Iyotaka Union/1201989246 INSERT INTO alecache (content, cachedUntil, host, path, params) VALUES ('<?xml version=\'1.0\' encoding=\'UTF-8\'?>\r\n<eveapi version=\"2\">\r\n <currentTime>2009-05 -15 06:06:37</currentTime>\r\n <result>\r\n <characterID>684446508</characterID>\r\n <name>Iyotaka</name>\r\n <race>Amarr</race>\r\n .... snip ....
The second run produces the expected AleParserXMLElement Object and just this:
Quote:
name/characterID corp/corpID Iyotaka/684446508 Iyotaka Union/1201989246
Note: I am not printing the characterSheet in the test - generates unneeded output - which is why I am surprised by the SQL output.
And lastly, a request. The SQL code it generates, especially with eve-central (getting all Trit sales for examples) creates a ridiculously long line - too large for my SQL server - complains of a transaction buffer overflow, or something like that - which makes it fail (I guess I may need to disable cacheing as a solution?). However, I would also much prefer an INSERT command that is not trying to INSERT everything as a single command(line) - although that probably makes your alecache statement a lot simplier. Still, it would be very nice if the output had a few more line-breaks in it. Or at least an option to affect the layout when "debugging".
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.05.15 08:49:00 -
[16]
Actually, __construct() is a constructor. It changed from PHP4, where constructor was function named as class itself. http://php.net/manual/en/language.oop5.decon.php
For unnamed attributes and methods see __get and __call methods and AleUtilContext class. AleUtilContext is responsible for chaining section->call(). http://php.net/manual/en/language.oop5.overloading.php
The cache is intentionally simple and oblivious to structure of data. Otherwise I would have to code separate cache logic for every call. But nothing prevents you to make your own cache . Large amounts of data might be a problem, especially when you don't have access to db configuration. I'll add another config option for DB caches: maxDataSize (or something) to ignore larger data. Hopefully this weekend.
Joomla! in EVE - IGB compatible CMS. |
Iyotaka
Iyotaka Union
|
Posted - 2009.05.15 09:35:00 -
[17]
thanks for the links. I am just switching to PHP5 logic, and am missing the ease I could used Class::method(arg) for doing a query e.g..
I am hoping I'll find what I need there.
And the maxDataSize sounds like an excellent option.
Making my own cache - interesting challange - I'll wait for your maxData fix, look at the differences, and then have a better idea where I need to be looking.
It might be real easy
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.05.15 10:14:00 -
[18]
Btw, what version/config you're using? RC2/cache.class=mysql? I'm just checking code and I don't one fkin reason why should the library dump SQL into output.
Joomla! in EVE - IGB compatible CMS. |
Iyotaka
Iyotaka Union
|
Posted - 2009.05.16 16:50:00 -
[19]
Edited by: Iyotaka on 16/05/2009 16:51:00 This is the downloaded link - so I assume it is RC2.
I tried grep -i version but got nothing sensible.
http://sourceforge.net/project/showfiles.php?group_id=233060&package_id=307334&release_id=678386 - the Forge pages dates it as 25 April
When I set cache to Files it seems to be working better.
|
Clark Manson
|
Posted - 2009.06.10 02:05:00 -
[20]
Edited by: Clark Manson on 10/06/2009 02:10:16 Getting this...any ideas? Trying to get character sheet of second pilot on account when this happens. Pilot just so happens to be me...so no weird things with the name or anything.
Fatal error: Uncaught exception 'AleExceptionCache' in /ale/cache/mysql.php:62 Stack trace: #0 /ale/cache/abstractdb.php(82): AleCacheMySQL->execute('SELECT * FROM a...') #1 /ale/base.php(133): AleCacheAbstractDB->setCall('char/CharacterS...', Array) #2 /ale/base.php(116): AleBase->retrieveXml('char/CharacterS...', Array) #3 /ale/eveonline.php(214): AleBase->_retrieveXml(Array, Array) #4 /ale/util/context.php(53): AleEVEOnline->_retrieveXml(Array, Array) #5 [internal function]: AleUtilContext->__call('CharacterSheet', Array) #6 /ale/register.php(137): AleUtilContext->CharacterSheet() #7 {main} thrown in /ale/cache/mysql.php on line 62
Code snippet that it is running in register.php is as follows (this runs fine with the first character)
$account = $ale->account->Characters(); foreach ($account->result->characters as $character) { $characterID = (string) $character->characterID; echo("characterID: ".$characterID."<br/>"); $ale->setCharacterID($characterID); $xml = $ale->char->CharacterSheet(); //<----line 137 code that is breaking }
|
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.06.10 10:26:00 -
[21]
Edited by: Lumy on 10/06/2009 10:29:22 Hi. Use "try { } catch ( ) { }" block to display error message. See this example http://sourceforge.net/docman/display_doc.php?docid=174326&group_id=233060. This will show whole SQL error, which will be more helpfull. Post it here please, or file a bug report.
Joomla! in EVE - IGB compatible CMS. |
Clark Manson
|
Posted - 2009.06.11 03:02:00 -
[22]
Originally by: Lumy Edited by: Lumy on 10/06/2009 10:29:22 Hi. Use "try { } catch ( ) { }" block to display error message. See this example http://sourceforge.net/docman/display_doc.php?docid=174326&group_id=233060. This will show whole SQL error, which will be more helpfull. Post it here please, or file a bug report.
I removed the try-catch because it was not displaying anything....this was the only way I could get any feedback at all.
|
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.06.11 11:13:00 -
[23]
Originally by: Clark Manson
Originally by: Lumy Edited by: Lumy on 10/06/2009 10:29:22 Hi. Use "try { } catch ( ) { }" block to display error message. See this example http://sourceforge.net/docman/display_doc.php?docid=174326&group_id=233060. This will show whole SQL error, which will be more helpfull. Post it here please, or file a bug report.
I removed the try-catch because it was not displaying anything....this was the only way I could get any feedback at all.
No wai.
catch (Exception $e) { echo $e->getMessage(); }
should print error message from MySQL server. Unless you instantly redirect script to another page or something. Anyway this should give more info: turn on error_reporting to E_ALL and set display_errors to true. If it doesn't help, go to /ale/cache/mysql.php:62 and print mysql_error directly and let script die().
Please let me know what you'll find.
Joomla! in EVE - IGB compatible CMS. |
Clark Manson
|
Posted - 2009.06.12 02:59:00 -
[24]
Originally by: Lumy
Originally by: Clark Manson
Originally by: Lumy Edited by: Lumy on 10/06/2009 10:29:22 Hi. Use "try { } catch ( ) { }" block to display error message. See this example http://sourceforge.net/docman/display_doc.php?docid=174326&group_id=233060. This will show whole SQL error, which will be more helpfull. Post it here please, or file a bug report.
I removed the try-catch because it was not displaying anything....this was the only way I could get any feedback at all.
No wai.
catch (Exception $e) { echo $e->getMessage(); }
should print error message from MySQL server. Unless you instantly redirect script to another page or something. Anyway this should give more info: turn on error_reporting to E_ALL and set display_errors to true. If it doesn't help, go to /ale/cache/mysql.php:62 and print mysql_error directly and let script die().
Please let me know what you'll find.
Yes Wai
At any rate, after only adding error_reporting(E_ALL); ini_set("display_errors", 1);
and commenting out line 62, I am unable to reproduce the problem. I think I will leave those changes in for now...thanks. to my code, I am unable to reproduce the problem.
|
Percivs
Rule of Five The Junta
|
Posted - 2009.07.16 06:47:00 -
[25]
Lumy,
I can get the ec_ale call to work using the sample code;
<?php require_once '/home/server/cron/eve/ale/factory.php'; //get ALE object $ale = AleFactory::getEVECentral(); $params = array('typeid'=>array(34,35)); try { $xml = $ale->marketstat($params); } catch (Exception $e) { echo $e->getMessage(); } ?>
However, I cannot figure out how to access the results (and as you said above, there is no $xml->to_array call for the ec_ale implmentation.)
(This result is retrieved manually from http://api.eve-central.com/api/marketstat?typeid=34&typeid=35«ionlimit=10000002)
<?xml version="1.0" encoding="utf-8" ?> - <!-- Automatically generated data from EVE-Central.com --> - <!-- This is the new API :-) --> - <evec_api version="2.0" method="marketstat_xml"> - <marketstat> - <type id="34"> - <all> <volume>59434699454</volume> <avg>27.0471468244</avg> <max>11155.08</max> <min>0.3</min> <stddev>458.683518273</stddev> <median>4.13</median> </all> - <buy> <volume>13345712573</volume> <avg>3.8439031402</avg> <max>4.05</max> <min>0.3</min> <stddev>0.569185707614</stddev> <median>3.81</median> </buy> - <sell> <volume>46088986881</volume> <avg>4.2165384537</avg> <max>11155.08</max> <min>3.65</min> <stddev>497.597676035</stddev> <median>4.14</median> </sell> </type> - <type id="35"> - <all> <volume>14836130256</volume> <avg>4.07758552632</avg> <max>12.6199</max> <min>1.5</min> <stddev>0.80920055546</stddev> <median>4.01</median> </all> - <buy> <volume>9414047820</volume> <avg>3.90210952555</avg> <max>4.6</max> <min>1.5</min> <stddev>0.376084769977</stddev> <median>3.87</median> </buy> - <sell> <volume>5422082436</volume> <avg>4.50796986092</avg> <max>12.6199</max> <min>3.9</min> <stddev>1.00233444314</stddev> <median>4.225</median> </sell> </type> </marketstat> </evec_api>
however, I cannot determine how to walk the XML structure using ALE.
Would you (or someone) please give me some examples?
Specifically:
How do I reference the current typeid from the XML (to match to a invType.itemName lookup)? e.g.; $xml->marketstat-> ?
How do I reference the all,buy,sell branches of the XML data? e.g.; $xml->marketstat-> ? ->buy->avg; or e.g.; $xml->marketstat-> ? ->sell->avg;
(I'm pretty sure that my attempt at providing a pseudo example of what I'm looking for is completely wrong and that there is going to need to be a foreach() call to walk the rows... but I'm at a loss at the moment and hoping for a ray of sunshine to light the way.)
I have some additional questions, but I think if I can get past the questions asked above, I will probably be able to figure out the rest on my own.
Awesome framework and thanks in advance! --- "All of us who are concerned for peace and triumph of reason and justice must be keenly aware how small an influence reason and honest good will exert upon events in the political field" - A.E. |
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.07.16 16:31:00 -
[26]
Edited by: Lumy on 16/07/2009 16:34:58 Hi. Eve Central returns SimpleXMLElement object.
//you have to use children() method, if element contains multiple elements of the same name foreach ($xml->marketstat->children() as $type) { //you can get name of element echo $type->getName();
//if it contains only elements with different names, you can access it as property of object //and don't forget to cast type to string echo (string) $type->all->volume; //this is how you can access attributes $attributes = $type->attributes(); echo $attributes['id'];
I hope this helps.
Joomla! in EVE - IGB compatible CMS. |
Percivs
Rule of Five The Junta
|
Posted - 2009.07.18 22:16:00 -
[27]
Lumy;
Awesome, thanks! --- "All of us who are concerned for peace and triumph of reason and justice must be keenly aware how small an influence reason and honest good will exert upon events in the political field" - A.E. |
Lumy
Minmatar Sebiestor tribe
|
Posted - 2009.08.05 21:35:00 -
[28]
Little update: Version 0.50.1 is up. Now with PostgreSQL cache plugin. Thanks to Luna Harkor.
Joomla! in EVE - IGB compatible CMS. |
Aedrine
|
Posted - 2009.08.17 14:18:00 -
[29]
Hello there,
Thanks for the good work! How do I complitely disable the sql part of the api? I'm happy to handle XML files and would rather do that.
I get:
Quote: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in /blabla/mysql.php on line 41
it's normal as I haven't set it up, just looking into how not to get that :)
Thx
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2009.08.17 14:39:00 -
[30]
Aedrine if you just want the raw XML to start with why are you trying to use a library when you can just grab the XML directly from API if that's what you want -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
|
|
|
|
Pages: [1] 2 3 :: one page |
First page | Previous page | Next page | Last page |