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

Rynlam
Gallente
|
Posted - 2007.12.24 19:06:00 -
[1]
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 -
[2]
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
|

Rynlam
Gallente
|
Posted - 2007.12.25 18:05:00 -
[3]
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?)
|

Rynlam
Gallente
|
Posted - 2008.01.03 16:04:00 -
[4]
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
|

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

Rynlam
Gallente
|
Posted - 2008.02.21 02:10:00 -
[6]
$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.
|

Rynlam
Gallente
|
Posted - 2008.02.26 16:23:00 -
[7]
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 -
[8]
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 -
[9]
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 -
[10]
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 -
[11]
I've added my stuff to wiki.eve-dev.net
|

Rynlam
|
Posted - 2008.07.17 17:16:00 -
[12]
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...
|
|
|