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
 

Pheal - simple to use full featured PHP5 API Library

Author
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#1 - 2011-10-26 07:23:17 UTC
Hello everyone,

i noticed that there is no Pheal post here yet, so i decided to port my old post from the old forums over here.

"Peter Powers" wrote:

Hello everyone,

during the last few days i had a look at the available PHP API Libraries,
and well decided i'd be better of porting my Ruby Library (EAAL) to PHP.

so i did (mostly last night), and now its time for a first release.

you can get the library at github,
you will also find a little bit of documentation there.

a few more words why i wrote this instead of using Yapeal or Ale, you can find
in my Blog.

Hint: While the library works alone, it integrates very well in King23
(the framework i used for building northern-crusade).

best regards,
PP

PS: you can find a page about it on the eve-dev wiki too.


since that post Pheal has constantly been extended and improved by several people,
special thanks go here to Wollari who really put alot of efford in it.

Today i published v0.1.0 (click on "tags" on github to find a download link)

Pheal-0.1.0 has
- custom keys enabled by default
- ssl enabled by default
update if you want to use custom keys (you should want that)
dont update if you only have legacy keys and dont want to switch.

3rdPartyEve.net - your catalogue for 3rd party applications

Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#2 - 2011-12-02 09:48:46 UTC
since some other libs who needed changes for the new extension got a bumb by their new version i take the freedom to bump this post aswell.

Pheal should still be working with crucible without any changes.

regards,
PP

3rdPartyEve.net - your catalogue for 3rd party applications

Novect
Deep Core Mining Inc.
Caldari State
#3 - 2011-12-25 10:53:01 UTC  |  Edited by: Novect
bumpage!

More examples/documentation pretty pls! :D
Great tool!
Louis Vitton
Viziam
Amarr Empire
#4 - 2011-12-31 09:25:35 UTC
Hi peter,

I am trying to get Pheal to work. I have used version .0.14 before and got it to work nicely now i am trying version .0.1.0 but i can not get it to work i am not sure why. The code below is the one i am trying to get to work but there is no output.
I think they auto loader might not be loading but the path to Pheal.php is correct.

Any help that you could give me would be great thanks mate.

I am using windows with apache2 server.

Quote:
require_once "Pheal/Pheal.php";
spl_autoload_register("Pheal::classload");
PhealConfig::getInstance()->cache = new PhealFileCache();
$pheal = new Pheal("keyID", "vCode"[, "scope for request"]);

$pheal->scope = "eve";
$result = $pheal->CharacterID(array("names" => "Peter Powers"));
echo $result->characters[0]->characterID;
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#5 - 2012-01-02 02:48:55 UTC  |  Edited by: Peter Powers
Louis Vitton wrote:
Hi peter,

I am trying to get Pheal to work. I have used version .0.14 before and got it to work nicely now i am trying version .0.1.0 but i can not get it to work i am not sure why. The code below is the one i am trying to get to work but there is no output.
I think they auto loader might not be loading but the path to Pheal.php is correct.

Any help that you could give me would be great thanks mate.

I am using windows with apache2 server.

do you have any error message to work with?
like, try to set your PHP error reporting to E_ALL and check
your webservers errorlog if it doesn't output an error.

cause classload not working or anything as dramatic should put out quite a few messages.

3rdPartyEve.net - your catalogue for 3rd party applications

Louis Vitton
Viziam
Amarr Empire
#6 - 2012-01-02 03:03:06 UTC
No i didnt with that one. I have since tried a diff request and have received an error but when i attempt to make the folders writeable it wont work.

Erorr:
Quote:
generic error: 0 message: Cache directory '/.pheal/cache/KeyID/vCode/char/Characters/' isn't writeable
The KeyID and vCode there are the real ones on the error but didnt want to post them.

code:
Quote:
$keyID = '';
$vCode = '';

require_once "Pheal/Pheal.php";
spl_autoload_register( "Pheal::classload" );
$pheal = new Pheal( $keyID, $vCode, "char" );
PhealConfig::getInstance()->http_ssl_verifypeer = false;
//PhealConfig::getInstance()->api_base = 'https://api.eveonline.com/';
//PhealConfig::getInstance()->http_method = 'curl';
//PhealConfig::getInstance()->http_post = false;
PhealConfig::getInstance()->cache = new PhealFileCache();
PhealConfig::getInstance()->access = new PhealCheckAccess();
try {
$result = $pheal->Characters();
foreach( $result->characters as $character ) {
echo $character->name;
}
} catch( PhealAccessException $e ) {
echo "access error: ".$e->getMessage();
/* do something - example: disable key */

} catch( PhealAPIException $e ) {
echo 'api error: ' . $e->getCode() . ' message: ' . $e->getMessage();
/* do something - example: disable key */

} catch( PhealException $e ) {
echo 'generic error: ' . $e->getCode() . ' message: ' . $e->getMessage();
/* do something - example: wait 5 minute next key usage (network/cluster problem) */
}
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#7 - 2012-01-02 03:10:50 UTC
Louis Vitton wrote:
No i didnt with that one. I have since tried a diff request and have received an error but when i attempt to make the folders writeable it wont work.

Erorr:
Quote:
generic error: 0 message: Cache directory '/.pheal/cache/KeyID/vCode/char/Characters/' isn't writeable
The KeyID and vCode there are the real ones on the error but didnt want to post them.



you probably want to set a proper directory path there.
i'm not too familliar with windows permissions and such.

that said, from my understanding this, depending if you have a windows or a cygwin apache
tries to either write in the cygwin / path, which might be some confusing rights stuff
or with a xampp for example, it might try to write on the root of your working directories harddisk
like
c:\.pheal... which i could imagine to require administrator privileges.

try giving some path that it doesnt need those rights in by doing someting like

PhealConfig::getInstance()->cache = new PhealFileCache('path/to/somewhere');

i wish i could be of more assistance here.. maybe someone else who runs it on windows has an idea.

3rdPartyEve.net - your catalogue for 3rd party applications

Louis Vitton
Viziam
Amarr Empire
#8 - 2012-01-02 03:22:04 UTC  |  Edited by: Louis Vitton
Thank you. I have tried alot of other query's also and alot of the time it doesnt fetch the API or even try to. I will try it on my Ubuntu server soon and see if I can get it working.

There is no real install process is there just download and unzip really?

Thank you for your help and time also. :)

Cheers Louis

Also now trying

PhealConfig::getInstance()->cache = new PhealFileCache(__DIR__ . '/.pheal-cache/');

Same issues as before just added the new location with the error message.

This same error is happening on my Apache2 ubuntu web server also the persmissions for the folder where pheal is stored on there is 755 and 755 on the file i am using with the pheal query in it.
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#9 - 2012-01-02 10:57:09 UTC
Louis Vitton wrote:

This same error is happening on my Apache2 ubuntu web server also the persmissions for the folder where pheal is stored on there is 755 and 755 on the file i am using with the pheal query in it.

and the owner of the folder is the apaches user?

something else i could think of would be your key containing illegal characters for the filesystem

3rdPartyEve.net - your catalogue for 3rd party applications

Louis Vitton
Viziam
Amarr Empire
#10 - 2012-01-03 07:32:14 UTC
Yes its my own. The old Pheal from the tutorials stickyed on this forum works fine though. Seems weird to me that i cant get this new one to work.
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#11 - 2012-01-04 22:18:22 UTC
Louis Vitton wrote:
Yes its my own.

usually the apache user is not your user..

i believe the default user for apache2 on ubuntu should be www-data, so www-data needs write rights.

Quote:

The old Pheal from the tutorials stickyed on this forum works fine though. Seems weird to me that i cant get this new one to
work.

that indeed seems weird, as i said, have you checked if the new style key has only characters that are allowed in the filesystem?

3rdPartyEve.net - your catalogue for 3rd party applications

Louis Vitton
Viziam
Amarr Empire
#12 - 2012-01-29 10:29:34 UTC
All working now and thank you for your assistance.

Is there going to be an update to accomidate the changes made in te latest patch to the API or shall they work anyways on the current version?

Cheers mate.
Ingrid Pitt
Furious Curious Mammals
#13 - 2012-01-29 19:23:29 UTC
I've been reading through forum posts and readmes trying to understand how Pheal works, but clearly I'm simply not understanding some basic part of how it prepares and retrieves information. Apologies if this seems basic but there certainly seems to be an assumption that this must be obvious, but it's certainly not to me. In fact I'm not even sure how to go about asking so my questions might even look a bit weird!

Firstly, I've now figured out how to get this to work...

Quote:

### Example 2, getting the id for a given character name
require_once "Pheal/Pheal.php";
spl_autoload_register("Pheal::classload");
$pheal = new Pheal("keyID", "vCode"[, "scope for request"]);

$pheal->scope = "eve";
$result = $pheal->CharacterID(array("names" => "Peter Powers"));
echo $result->characters[0]->characterID;


seems I have to remove "[, "scope for request"]", probably because the scope is included here instead ... "$pheal->scope = "eve";" (Bah! Why include that in the example then! Shocked, and that example doesn't even appear to need KeyID or vCode).

Okay, but why doesn't it need the "account" scope? Hmmm.

Well let's say that I wanted to retrieve a characters contact list. That seems to want userID, apiKey and characterID. Well I can see where and how to add the scope ($pheal->scope = "char";), and I'm presuming that I change keyID and vCode to something valid this time (such as $pheal = new Pheal("12345", "fgdhfghdgfhdetc");), but where and how do I feed it the characterID?

I guess I could do with seeing a few annotated examples. I tried Trenker's tutorial but I can't get his example to work.

I'm just looking for a way in, so all help appreciated!
Louis Vitton
Viziam
Amarr Empire
#14 - 2012-01-29 21:10:13 UTC
Hey mate,

First upi am on my phone at wOrk so sorry for the short reply I will give more detail later.

I think pheal uses a combination of curl and simple XML to make its requests to the API.
First up if you can't get that tutorial to work. What version of php are you using and MySQL also? Ploys what are you using for your web host eg apache on Ubuntu os.

I shall update this more later with some examples from the pheal version your using.
Ingrid Pitt
Furious Curious Mammals
#15 - 2012-01-29 23:34:19 UTC
Thanks for the quick reply! However, I think I've just cracked it (or at least got a foot hold, or maybe just a toe jam)...

I'll carry on and see how far I can get but I've proved I think that it's just my lack of understanding the library and poor OOP skills that's letting me down.

Louis Vitton
Viziam
Amarr Empire
#16 - 2012-01-30 07:28:38 UTC
Good news mate, i had my issues with pheal but it was just me not getting it right its a great thing pheal and if you have more questions i shall help if i can or peter will know as he is the MAN!
Sol Laxon
Talu Shaya
Talu Shaya Empire
#17 - 2012-01-30 18:04:16 UTC
Hello, is there a quick reference for querying various things?

For example I am able to get the system name from the EVE browser, but I need to convert it to an ID. Can pheal do that?
Then from that ID I would like to grab and cache the number of jumps in that system.

I am just not sure how to proceed when it comes to getting something like jumps, or podkills etc. Most of the examples are with the character area.
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#18 - 2012-01-30 18:15:42 UTC  |  Edited by: Peter Powers
Sol Laxon wrote:
Hello, is there a quick reference for querying various things?

For example I am able to get the system name from the EVE browser, but I need to convert it to an ID. Can pheal do that?
Then from that ID I would like to grab and cache the number of jumps in that system.

I am just not sure how to proceed when it comes to getting something like jumps, or podkills etc. Most of the examples are with the character area.


Hello,
since Pheal basically maps the API xml to methods, Pheal can provide you with the stuff that the API provides.
you can find a list of things at http://wiki.eve-id.net/APIv2_Page_Index, but i think it might be missing the latest additions for retrieving item ids.

stuff like solarsystemID's or jump data is not available through the API so pheal cannot provide you with that information.
You can however get the information you need to build such functionality for your app in CCP's static data dump.
while it does not provide you with jump numbers it contains all data needed to calculate them yourself.

regards,
PP

3rdPartyEve.net - your catalogue for 3rd party applications

Sol Laxon
Talu Shaya
Talu Shaya Empire
#19 - 2012-01-30 18:28:39 UTC  |  Edited by: Sol Laxon
Hello Peter,

Thanks for the quick reply.
I noticed for example that the sovereignty(); xml output contains both system names and the system ID's which solves that issue.
Once cached I am just going through it with simplexml. and xpath

I would like some input on caching though, when I go $pheal -> Jumps(); It doesn't cache the output. Is there something I have to do to make sure that it is being cached? It works naturally on $pheal -> Sovereignty();

I am probably missing the fundamental basics here, but would really appreciate if you could get me on the right path with this.


EDIT: here is the base code I am working from.
Quote:


require_once "pheal/Pheal.php";
spl_autoload_register("Pheal::classload");
PhealConfig::getInstance()->cache = new PhealFileCache('[path]/cache/');
PhealConfig::getInstance()->archive = new PhealFileArchive('[path]pheal/cache/');
$pheal = new Pheal(null, null, 'map');
$pheal->Jumps();

Sol Laxon
Talu Shaya
Talu Shaya Empire
#20 - 2012-01-30 18:36:02 UTC
Also what I have in the cache looks like this:

public/public/map/Sovereignty/Request.xml

and the exact copy in a dated folder. No /map/Jumps as I would expect.
12Next page