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.
 

Yapeal PHP API library (version 1.0.5)

First post
Author
Crassus Detlator
Tribal Liberation Force
Minmatar Republic
#301 - 2012-08-18 21:42:11 UTC  |  Edited by: Crassus Detlator
Hi Dragonaire,
First and foremost, thank you very much for all the time and effort you put into developing this library. Thank you!

Quote:
Now, to the annoying part of my post:
I'm trying create a site that makes users register and upon submitting their API, they should select the character/s they want to associate to the webapp.
Now, I managed to create all the forms to submit the API data, and have YAPEAL run to register the API on the proper tables. But, the character list to that account won't be populated until the cronjob runs...
Is there a way to force that, via php, say when the API is succesfully registered?
I can't seem to make it run with a simple 'exec('php -f yapeal.php')'.

Suggestions?
I really wouldn't like for the users to have to wait until the cronjob to see their character list in order to choose what chars to use in the webapp.


That was my original post.
I've now read all the posts in this thread, and poked a little more around the inards of Yapeal.
My question remains though...
I want a user of my webapp, to register, go to some sort of admin page, input an api, and get a list of characters to use inside the webapp.
The problem I cannot wrap my head around, is that there must necessarily be a yapeal.php execution between the "input an api" step, and the "get a list of characters" step.
Even with the cronjob running every minute, it wouldn't be an instant choice for the user.

Should I handle this "registering" without yapeal, filling out the yapeal tables "by hand", and then tell the user something like "the servers are working on retrieving your information" until the next cronjob hits, and his data is finally on the database?
Or is some funcionality I'm missing?

Again, thanks for all the work you guys put into this wonderfull library!
Crass.
Dragonaire
Here there be Dragons
#302 - 2012-08-25 04:11:42 UTC
Sorry for the late replies but I wasn't feeling will for a couple days and computer also decided to act up and I ended up having to re-install OS so it took a couple days to get back on.

@Mikokoel - Glad to see you found a fix for the version problem. The reason 5.2.8 was picked is some of the code in Yapeal was running into a bug in PHP and there wasn't a real work around for it. I decided that since PHP 5.2.8 is now 2+ years out of date and two generation outdated that everyone really should be put pressure on their hosting service to update or finding a better one that actually cares about security etc as well Blink

@Crassus Detlator - One area that Yapeal isn't as good at is in a sign-on scenario like you described. It is something I plan on improving but it will require a lot of re-writing on Yapeal to make happen which is never something to be undertaken lightly. Now to ways to minimize issues and make Yapeal sort of work in what you are doing. First I think the problem you are have trying to use exec etc is by default you will end up getting the CGI version of PHP and you need the CLI version. You need to find out the full path to it and use that when trying to call it from a web page which uses CGI. Now to getting Yapeal to only grab the API you need in a more timely matter. You have the option to have it use a different ini config file from by adding the -c or --config= option. How this helps you is by having a separate sign-in DB with only the account APIs active. Yapeal will still run in a batch mode like always but since these APIs are all small and you should only have info for new accounts that are just signing up it will grab the info from the APIs quickly. You just need to have you application check for records with a owner matching the suppled key and move them over to your main DB when they appear or as soon as the application user has decided on which one they want information about and delete them from the sign-in DB. Used this way Yapeal should seem no different then something that gets just a single user's records. One thing to remember is you can have multiple Yapeals running at the same time with a little thought and care and they can use different configurations. Hopefully that gives you an idea how to go about making it work for you doing something that it wasn't really made for but is possible with a little thinking outside the box. Smile

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

Crassus Detlator
Tribal Liberation Force
Minmatar Republic
#303 - 2012-08-25 15:29:31 UTC
Hi Dragonaire,
Thanks for you reply!
I'll try out your suggestion, though it seems a little like trying to square the circle. Yapeal is great once the registration is made, and I think the concept of updating everything through cronjobs is awesomely simple and it prevents the users to overload my server and the API server since it manages the cachedUntil times all by itself.

I really don't think that you should rewrite in order to accomodate for this.

What I think would be the best solution is to use an ajax library such as pheal to fill the yapeal tables for registered accounts and characters, and then have the user wait until the cronjob hits.
I saw on this thread that you recommended to run yapeal's cron every minute or so, so that wouldn't be too much of a wait for the user (59 seconds for the most unlucky one). After all, we have this love-hate relationship with our users, so I'll consider this as a little tasty white lie... "Our servers are processing your information"... not.

I want to thank you again for all the work and dedication you put into yapeal, this is one of the things that keeps me playing EVE: the community.
Thanks! And I hope you are feeling better!

Crass.
Drapko Nitzhonot
Abdera Logistics
#304 - 2012-09-09 22:42:39 UTC  |  Edited by: Drapko Nitzhonot
I've updated Yapeal from Mercurial one week ago or so and I'm getting mails no matter what log level I use in logger.xml
Quote:
curl_error: Operation too slow. Less than 10 bytes/sec transfered the last 12 seconds


Thanks.
Dragonaire
Here there be Dragons
#305 - 2012-09-10 05:44:07 UTC
That's caused by API servers not working right not anything that can be done about it in Yapeal. Basically the API server is failing to continue connection after allow Yapeal to connect.

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

Drapko Nitzhonot
Abdera Logistics
#306 - 2012-09-10 12:40:51 UTC
I meant my problem is I'm receiving these errors in my email.
We talked about this some months ago (https://forums.eveonline.com/default.aspx?g=posts&m=946317#post946317). You told me to change log level from "warning" to "info" to avoid this mails (it worked perfectly). It seems there is a problem with log levels because I'm getting this emails again (after upgrading last week).

Thank you.
Bluedisguise
Moglers Inc.
#307 - 2012-09-10 14:33:07 UTC  |  Edited by: Bluedisguise
Hey!

First off, thank you for making this script - absolutely fantastic and exactly what I've been looking for. Will push some ISK your way as soon as I can :)

Second off, a few questions:

(1) I've been enabling sections manually, because not being a coder I couldn't figure out your code example :). The way I've been doing this is by going into the utilsections portion of the MySQL database, and then adding the appropriate API Masks. So, for example, I have rows that look like:

activeAPIMASK, isActive, proxy, sectionID, section

8388608, 1, NULL, 7, corp
1048576, 1, NULL, 18, corp
2097152, 1, NULL, 19, corp


With these settings, I get the corporation transaction log and wallet log (1048576 and 2097152), but I get *no data* returned for contracts (8388608).

Now, this *could* be because I am using "sectionID" wrong in this table. Or something else. Any thoughts or a point in the right direction would be great :)

(2) Is there a more straightforward way for me to simply activate *Everything*? For my particular useage, weekly updates will likely be the name of the game, so I'm not too worried about restricting my download (and really all of the corp data would be helpful...).

It would be *tremendously* helpful if there was a pre-built script that did #2 above, with which I could comment out APIs I'm not interested in. Even if it's just for an example.

Edit with more info: No errors in yapeal.php from the CLI, no error log outputs, as far as I know I am logging everything via the config file.

Thank you!
Dragonaire
Here there be Dragons
#308 - 2012-09-10 16:07:14 UTC
Bluedisguise - You can't just add more rows to utilSections but need to change the activeAPIMask. The mask is a bitmap but you can make it with simple addition as well as by binary ORing them together like in the examples. So to get walletJournal and walletTransactions you use 3145728 for the activeAPIMask on the corp row.

Also you asked if there is anyway to just have everything on but that is the default mask used so you should be able to just leave everything alone and Yapeal will just work Blink There was a time where most things were off by default but now they are turned on as both the API servers and Yapeal now handle it without any problems normally.

Drapko Nitzhonot - Make sure you changed it from info to warning not the other way around as you posted Blink as that would be turning them on.

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

Bluedisguise
Moglers Inc.
#309 - 2012-09-10 16:24:43 UTC
Oh goodness, I see now.

Any thoughts on why I am not getting any corporate contract data with the utilsections row:

46068159, 1, NULL, 3, corp

?

Right now the table 'corpcontracts' returns 0 rows.
Dragonaire
Here there be Dragons
#310 - 2012-09-10 21:17:05 UTC
Bluedisguise wrote:
Oh goodness, I see now.

Any thoughts on why I am not getting any corporate contract data with the utilsections row:

46068159, 1, NULL, 3, corp

?

Right now the table 'corpcontracts' returns 0 rows.

Make sure it's active in the API key you have. You can see the actual mask returned from the API for the key in the accountAPIKeyInfo table. Also make sure there are some active corp contracts as the API only returns current 'pending' contracts if I remember right.

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

Bluedisguise
Moglers Inc.
#311 - 2012-09-10 23:46:04 UTC  |  Edited by: Bluedisguise
I triple-checked with EvEHQ as well, and yes I do have access to contracts. Using EvEHQ (or just the raw XML dump from the contracts XML page) I am able to see historic as well as pending contracts.

Edit:
I just looked in utilxmlcache, and within that "api : Contracts" "section: corp" has an entry that contains all of my contract data. It just isn't being loaded the last yard into the corpcontracts MySQL table for some reason.
Drapko Nitzhonot
Abdera Logistics
#312 - 2012-09-11 17:08:37 UTC
I tried both log levels again to be sure: warning and info. I receive emails with both.

Setting "warning" level I receive emails with "INFO" inside... I don't know if that word should only appear if "info" log level was selected:
Quote:
curl_error: Operation too slow. Less than 10 bytes/sec transfered the last 12 seconds
curl_error: Operation too slow. Less than 10 bytes/sec transfered the last 12 seconds
2012-09-11 17:00:48.658
INFO: Operation too slow. Less than 10 bytes/sec transfered the last 12 seconds for API https://api.eveonline.com/corp/AccountBalance.xml.aspx
File: /home/javi/doc/yapeal/class/YapealNetworkConnection.php(100)

Thank you.
Dragonaire
Here there be Dragons
#313 - 2012-09-14 03:48:56 UTC
Drapko Nitzhonot - When I look at you error message it doesn't seem right as line 100 shouldn't be the one returned. It should give line 99 if anything. Here's what me lines 99-106 look like:
$result = $this->con->post($url, $postList);
if (!$this->con->success) {
if (Logger::getLogger('yapeal')->isInfoEnabled()) {
$mess = $this->con->error. ' for API ' . $url;
Logger::getLogger('yapeal')->info($mess);
};
return FALSE;
};

If yours is different you might try following install instructions again as not everything was updated correctly it would seem.
Also make sure you are changing the right line to turn info on and off. In config/logger.xml on line 124 you should change it from info to warn.

Bluedisguise - Might try clearing out the XML file in the cache and the DB cache at utilXmlCache in DB if you have it on. Sometimes for unknown reasons Yapeal will decided not to add stuff into the APIs but clearing the cache files seems to make it start working again P

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

Drapko Nitzhonot
Abdera Logistics
#314 - 2012-09-15 12:45:14 UTC
I did hg clone from somewhere I don't remember and I had an outdated version. I have just done hg clone http://hg.code.sf.net/p/yapeal/code yapeal-code

Thanks Dragonaire.
Somerset Mahm
Cognitive Distortion
#315 - 2012-09-26 05:12:40 UTC  |  Edited by: Somerset Mahm
Hello!

I am (finally) running shiny latest Yapeal with CAK :P

Everything is working fine, but I have set the log level all the way to "debug" and I still am getting nothing in the logs at all. My config entry is:

log_config=YAPEAL_CONFIG "logger.xml"

Edit: after further troubleshooting, if I run Yapeal from the command line directly, I can get it to write to the files (if I intentionally make it error out). It doesn't write to them when run from cron, though.

SOMER Blink Microlotteries that finish in minutes! Running for over 2 years :)

Dragonaire
Here there be Dragons
#316 - 2012-09-30 03:05:45 UTC
Somerset Mahm wrote:
Hello!

I am (finally) running shiny latest Yapeal with CAK :P

Everything is working fine, but I have set the log level all the way to "debug" and I still am getting nothing in the logs at all. My config entry is:

log_config=YAPEAL_CONFIG "logger.xml"

Edit: after further troubleshooting, if I run Yapeal from the command line directly, I can get it to write to the files (if I intentionally make it error out). It doesn't write to them when run from cron, though.

Yapeal actual now uses several different log files like log/yapeal_fatal.log, log/yapeal_error.log etc but generally you shouldn't see anything outside of error, warning, or info once in a while. By default Yapeal is very quiet if nothing is causing errors any more unlike it use to be where it could fill up it's logs in a day but now only does so on actual problems.

For not seeing anything when you are knowingly causing errors in crontab you probably need to check if cron is running with different user or something which doesn't have write access to where Yapeal is installed. You might try TEMPORALLY making the log directory world writable to see if that makes a difference. Also remember you need to manually edit paths in config/logger.xml if you are trying to move the log files from their default locations.

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

Lluerssen
PHUB Corporation
MOONFIRE.
#317 - 2012-10-07 16:57:02 UTC
Guys, what is best way, to check validity of api key?

Sister of EvE: http://SisterOfEvE.ru/ Loot History Analyzer: http://SisterOfEvE.ru/loot_history/

Dragonaire
Here there be Dragons
#318 - 2012-10-13 08:32:05 UTC
Lluerssen wrote:
Guys, what is best way, to check validity of api key?
Check it with the http://wiki.eve-id.net/APIv2_Account_APIKeyInfo_XML API. Api server returns errors for bad keys and it can tell you what type and what API access the key provides.

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

Dragonaire
Here there be Dragons
#319 - 2012-10-19 15:59:34 UTC
Just to let everyone know that might have seen some other API applications and tools that are breaking with CCP turning off HTTP and going to just HTTPS I changed Yapeal over months and months ago when they first announced the change so there should be no problems with it. Do report any bugs though just in case there is something some where along the line that was missed Blink

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

Kivorno
Myanapa Corsica
#320 - 2012-10-23 16:54:54 UTC
Hi,

Getting this error but dont know what it is attributed to:

Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to get ADOFieldObjects for columns in YapealQueryBuilder' in /home/public_html/yapeal/class/YapealQueryBuilder.php:148
Stack trace:
#0 /home/public_html/yapeal/class/util/RegisteredCharacter.php(112): YapealQueryBuilder->__construct('utilRegisteredC...', 'mysqli://kivorn...')
#1 /home/public_html/account/addInfo.php(41): RegisteredCharacter->__construct(Object(SimpleXMLElement))
#2 {main}
thrown in /home/public_html/yapeal/class/YapealQueryBuilder.phpon line 148

Any help would be appreciated.

Proud creator and developer of Eve-Merchant / Eve-Merchant Sprint