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.
 

[Seeking Assistance] Converting/Outputting API calls to a readable browser friendly format

Author
Captain Teuta
Aliastra
Gallente Federation
#1 - 2013-11-07 11:05:20 UTC
Greetings!

I am currently working on a project that requires the mind of someone more familiar with the concepts and protocols required to complete my project. Weather or not it is out of my skill level and current programming capability is irrelevant as I still have to complete it. So I will give this a shot! =)

The task I wish to complete is a rather in depth and complicated one. This being said I'll do my best to explain my inquiry in way that reflects a simpler task that I can adapt to my main project once I've overcome the fundamentals.

As I am new to working with the EVE Online API and XML my question may or may not be relevant to what I am actually trying to achieve.

How do I print the output of an API call (If that is in fact what it's called) to the browser in a format that's both readable and browser friendly. This output I would like to have the option of styling my self. I know that it's possible to use XSLT to transform XML into another doc type such as HTML. Not exactly sure how (though I know I can figure it out if need be) or if this is the most efficient way of achieving my preferred end result. Maybe there is a 'better' way?

Where does the API Call start? How is the call initiated? The understanding of these two basics would serve me well to know I believe but not required.

I 'do not think' that I want to display the API output directly to the browser. Rather, I would like to store the information in a MySQL database to iterated over later with PHP when ever and where ever I want on the browser/site/app. Each one of the rows in my database will have data NOT collected by the API that I will have to enter manually. I'd like to keep it organized. So I'd like to store the output to the database. I need to be able to store each piece of requested data into a different column/cell/row. I'd like to store the corporationID, corporation, allianceID, alliance etc, each in there own cell on the same row that corresponds with that characters info. (Maybe I don't need the ID's just the raw output of the ID's. The corp and alliance it's self.)

Example: Here is an example of a result for a API EVE Character Info call.

Result (no API key supplied)

I assume this is the result of a API call for character info. (with no API given as parameters)

Step 1.) How was this call made?

Step 2.) Once I receive the above result after I make the call how do you suggest I format and or display it to a browser friendly format?

Step 3.) OR how do I, as stated above, direct the output of the call (the results) to my MySQL database?

Any wisdom, advice, or pointers will be GREATLY appreciated. Been stuck on this for weeks.

Regards,
Captain
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#2 - 2013-11-07 12:39:52 UTC  |  Edited by: Steve Ronuken
PhealNG should make your life easier for handling the api.


Yapeal is another option, for loading the data directly into the database.


anyway, if you want to look at handling the data yourself:

https://gist.github.com/fuzzysteve/7317000

is a very basic example of how to retrieve data using PHP. What you do with it then is up to you. You could feed it into database, for example. If you do, make sure you do it using PDO, with parameters, rather than direct injection into the sql. Not using parameters is just asking for little bobby tables to come along and drop your database.

As for how you make it browser friendly, you write the PHP to output html and display that. XSLT is an option, but not a brilliant one, if you plan to do /anything/ but display the data.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Captain Teuta
Aliastra
Gallente Federation
#3 - 2013-11-07 12:51:55 UTC  |  Edited by: Captain Teuta
Steve Ronuken wrote:
PhealNG should make your life easier for handling the api.


Yapeal is another option, for loading the data directly into the database.


anyway, if you want to look at handling the data yourself:

https://gist.github.com/fuzzysteve/7317000

is a very basic example of how to retrieve data using PHP. What you do with it then is up to you. You could feed it into database, for example. If you do, make sure you do it using PDO, with parameters, rather than direct injection into the sql. Not using parameters is just asking for little bobby tables to come along and drop your database.

As for how you make it browser friendly, you write the PHP to output html and display that. XSLT is an option, but not a brilliant one, if you plan to do /anything/ but display the data.


Thanks for your reply and sorry for my ignorance on the matter. I attempt to use your github code and i receive a blank page.

Any ideas?
Chuck Turing
Solarmark
Stellarium Alliance
#4 - 2013-11-13 18:18:41 UTC
Quote:


Thanks for your reply and sorry for my ignorance on the matter. I attempt to use your github code and i receive a blank page.

Any ideas?


You get a blank page because the api has expired.

If you visit:

https://api.eveonline.com/corp/WalletJournal.xml.aspx?keyID=54534435&vcode=7okqZ1g453453453453453453n2B0eIh8UGnVWqb2wkyd21C&characterID=90926985&accountKey=1000

You will get this:


Key has expired. Contact key owner for access renewal.

Change it for your own API, and it will probably work :)