Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |

Frank Martin Statham
Trident Research
2
|
Posted - 2012.12.03 15:22:00 -
[1] - Quote
I have been trying to teach myself PHP/MySQL - I have had limited success, able to figure most things out eventually. I am certainly non expert.
I found some tutorials regarding the API and PHP and how to get the XML using APIs.
I have had great success getting data into my databases from api.eve-central.com using APIs for various items etc.
When trying to get the XML from api.eveonline.com - I am having trouble.
I found this in a tutorial but have been unable to get it to work -
Quote:// MAKE API REQUEST function makeApiRequest($url) {
// Initialize a new request for this URL $ch = curl_init($url);
// Set the options for this request curl_setopt_array($ch, array( CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data CURLOPT_SSL_VERIFYPEER => false, // Do not verify the SSL certificate ));
// Fetch the data from the URL $data = curl_exec($ch);
// Close the connection curl_close($ch);
// Return a new SimpleXMLElement based upon the received data return new SimpleXMLElement($data); }
I tried the file_get_contents()" and simplexml_load_file commands as well but keep getting NULL values in my returns.
I know the $url is valid because I can use it by itself in the browser and it works.
Is there a decent resource to help me along or can someone post a bit of code that will help me understand?
Thanks,
Frank
|

Shionoya Risa
The Xenodus Initiative.
54
|
Posted - 2012.12.04 08:55:00 -
[2] - Quote
I had a similar problem a few weeks ago and the below seems to be working for my purpose (API -> PHP -> MySQL).
Quote: // Get SkillInTraining from API Server $url = "https://api.eveonline.com/char/SkillInTraining.xml.aspx?keyID=$keyID&vCode=$vCode&characterID=$characterID";
$xml = simplexml_load_file($url); header('Content-Type: text/xml'); $dbxml = $xml->asXML();
// Write the new information to the database MYSQL_QUERY("UPDATE skillsheet_apis SET training = '$dbxml' WHERE characterID = '$characterID'");
I was using curl to get the api xml for a very long time until this method was kindly pointed out to me. |

Frank Martin Statham
Trident Research
2
|
Posted - 2012.12.04 15:55:00 -
[3] - Quote
Thank you for your response.
It would seem the API server is down currently, but prior to that I was able to determine that the original issue was a server configuration problem (or at least appeared to be). Though I am getting XML parsing errors when trying to construct the XML with the original code.
I will have to give your method a try once the API server returns.
|

Louis Vitton
Jita Trade and Industry
20
|
Posted - 2012.12.05 02:10:00 -
[4] - Quote
also if you dont want ot make your own code to pull api there is pheal and yapeal they are both grate frameworks for pulling API info with php. Yapeal more then anything pulls the data with php but places it directy into a database so you just have to query the database and have a cron running to renew the info. |

Frank Martin Statham
Trident Research
2
|
Posted - 2012.12.05 13:28:00 -
[5] - Quote
Louis Vitton wrote:also if you dont want ot make your own code to pull api there is pheal and yapeal they are both grate frameworks for pulling API info with php. Yapeal more then anything pulls the data with php but places it directy into a database so you just have to query the database and have a cron running to renew the info.
Yeah I have been looking at both of those. In fact, setting up pheal currently. Though I will pick through and see how it works as this is as much a learning opportunity as anything else. Someday I will get his figured out - lol. I can see I made the right choice to be a forensic data specialist and not a programmer. Perhaps if I find a programmer who is trying to hide his work I will have better success! 
Thank you for your response. |

Steve Ronuken
Fuzzwork Enterprises
831
|
Posted - 2012.12.05 13:39:00 -
[6] - Quote
var_dump (http://php.net/manual/en/function.var-dump.php ) will be your friend, for picking apart the data.
You'll also, at times, have to cast the data out of the simplexml object, to be able to use it. what looks like a number is often not (as far as php is concerned) FuzzWork Enterprises http://www.fuzzwork.co.uk/ Blueprint calculator, invention chance calculator, isk/m3 Ore chart-á and other 'useful' utilities.As well as mysql and CSV/XLS conversions of the Static Data Extract. |

Frank Martin Statham
Trident Research
2
|
Posted - 2012.12.05 13:51:00 -
[7] - Quote
Let me say I am fan of your work Steve. I have been using your site and the information on your site to help me get started. In fact, i found your site when I was working on a spreadsheet and saw some of your posts here. I am a SQL guy by trade due to extensive use in what I actually get paid to do and seeing what you have done somewhat inspired me to move my project off the spreadsheet and onto a website. (Alright, I will make my pod out of your exhaust trail..)
I have been using var_dump. The problem is my dumps are not pretty (well are anyones' really?). More to the point. They are coming up with erroneous information.
Quote:https://api.eveonline.com/eve/CharacterID.xml.aspx?names=Frank Martin Statham
Works directly in the browser but then...
Quote:$url = "https://api.eveonline.com/eve/CharacterID.xml.aspx?names=Frank Martin Statham";
function makeApiRequest($url) {
$ch = curl_init($url);
curl_setopt_array($ch, array( CURLOPT_FOLLOWLOCATION => true, t CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, ));
$data = curl_exec($ch);
curl_close($ch);
return new SimpleXMLElement($data); }
$xml = makeApiRequest($url);
$var_dump($xml);
if ($xml->error) { $msg = (string) $xml->error; }
And I get crap.. absolute crap.. like an inverted midas touch... Though looking at my PHP skills I am not surprised.
I am not returning any valid XML. /sigh.
It is the actually call for XML that is completely new to me. Once I get it mastered... I shall be unstoppable! .. or something
|

Louis Vitton
Black Aces Against ALL Anomalies
20
|
Posted - 2012.12.10 05:19:00 -
[8] - Quote
http://blog.evepanel.net/eve-online/api/eve-api-tutorial-part-ii-requesting-data-from-the-api-and-save-it.html |

Peter Powers
Terrorists of Dimensions Free 2 Play
101
|
Posted - 2012.12.11 11:55:00 -
[9] - Quote
Frank Martin Statham wrote:Louis Vitton wrote:also if you dont want ot make your own code to pull api there is pheal and yapeal they are both grate frameworks for pulling API info with php. Yapeal more then anything pulls the data with php but places it directy into a database so you just have to query the database and have a cron running to renew the info. Yeah I have been looking at both of those. In fact, setting up pheal currently. Though I will pick through and see how it works as this is as much a learning opportunity as anything else. Someday I will get his figured out - lol. I can see I made the right choice to be a forensic data specialist and not a programmer. Perhaps if I find a programmer who is trying to hide his work I will have better success!  Thank you for your response. if you need help with understanding pheal, you know.. it might help to just ask ;) lots of os 3rd party guys are hanging out on #eve-dev on irc.coldfront.net, so usually you can get help there, even if it sometimes takes a bit =) 3rdPartyEve.net - your catalogue for 3rd party applications |

Frank Martin Statham
Trident Research
2
|
Posted - 2012.12.18 17:50:00 -
[10] - Quote
Louis Vitton wrote:http://blog.evepanel.net/eve-online/api/eve-api-tutorial-part-ii-requesting-data-from-the-api-and-save-it.html
I found this to be an excellent tutorial. The problem I was having is that my server was not configured correctly to allow this method. I have since corrected that, though I am using Pheal currently to achieve the same results.
Quote:if you need help with understanding pheal, you know.. it might help to just ask ;) lots of os 3rd party guys are hanging out on #eve-dev on irc.coldfront.net, so usually you can get help there, even if it sometimes takes a bit =)
Well be careful what you wish for because I have lots of questions! Actually, I have figured it out for the most part. I have a tendency to refrain from asking until I am completely stumped and exhausted nearly every idea I can come up with - just because I tend to learn more from my mistakes than from my successes.
Thank you though - I will probably use the resource you suggested as I get more involved in my application experiment!
Thanks again for the help! |
|
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |