Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
epsilonion
CLOVEN SKY IMPERIUM.
2
|
Posted - 2011.10.20 18:25:00 -
[1] - Quote
Hi
This is a snippet of code that I am trying to use and i get a error
'String could not be parsed as XML'
// create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $url); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch);
//Initializes the XML Parser $xml = new SimpleXMLElement($output); <--- error happens here...
I am sure this used to work before the changes... how would I beable to parse this?
I have looked at the apilib's and the lack of basic doc's and shell access to the host leads me to try and do it myself... the doc's dont even tell you where to put KeyID or VCODE info in the lib's never mind how to call say member tracking...
all i want to do is grab the api bang it in a database, thats it...
any help please |
plan q
Interstellar eXodus BricK sQuAD.
0
|
Posted - 2011.10.20 19:02:00 -
[2] - Quote
1. here is a example api http://api.eveonline.com/account/Characters.xml.aspx?&keyID=123124&vCode=43534634 2. from what i can tell your code "should work" as for how to call thing's i point you to this wonderful site http://wiki.eve-id.net/APIv2_Page_Index 3. as for "apilib's and the lack of basic doc's" i have no idea what your referencing as there are multiple libraries (some out of date) main ones being pheal, Yapeal dont yell at me if i forgot some. as for parsing you parse the xml like any other xml document |
Karbowiak
Sniggerdly Pandemic Legion
25
|
Posted - 2011.10.20 19:16:00 -
[3] - Quote
$url = "http://blablabla"; $output = file_get_contents($url); $xml = new SimpleXMLElement($output); blablabla..
|
epsilonion
CLOVEN SKY IMPERIUM.
2
|
Posted - 2011.10.20 19:27:00 -
[4] - Quote
i find eve-id is for more advanced users then myself... I require someone to say basically heres your curl request ing the xml from the server it puts it in say $data and you parse it like this.... of which there is no documentation out for that for any of the lib's even on eve-id..
if I can get simplexml working then I have cracked it I can finish off my project.. if not then I dont know what to do...
basically I can manipulate data, do sql, etc etc... its this api stuff thats making me bang my head on the wall...
Yapeal i think its that one that requires shell access to the host, ale well basically all of the lib's documentation requires your are very literate with api as the documentation does not even tell you what to call say for char sheet data, for this sort of thing I am finding it difficult as I have never done it b4.
|
plan q
Interstellar eXodus BricK sQuAD.
0
|
Posted - 2011.10.20 19:35:00 -
[5] - Quote
*cough try $url = http://api.eveonline.com/account/Characters.xml.aspx?&keyID=123124&vCode=43534634 *cough of course changing keyID to your keyID and vCode to your vCode /account/Characters.xml.aspx is what ever api page you want to pull you go to http://wiki.eve-id.net/APIv2_Page_Index and look for member tracking and copy and paste that link aka change /account/Characters.xml.aspx to /corp/MemberTracking.xml.aspx http://api.eveonline.com/corp/MemberTracking.xml.aspx?&keyID=123124&vCode=43534634 of course for this to work you need your api to be set to corp and not a personal one. |
epsilonion
CLOVEN SKY IMPERIUM.
2
|
Posted - 2011.10.20 20:01:00 -
[6] - Quote
all i get is the 'String could not be parsed as XML'
when tryint to parse the returned string
|
plan q
Interstellar eXodus BricK sQuAD.
0
|
Posted - 2011.10.20 20:20:00 -
[7] - Quote
really because it works for me $url ="http://api.eveonline.com/account/Characters.xml.aspx?&keyID=xxxxxx&vCode=xxxx"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); curl_close($ch);
$xml = new SimpleXMLElement($output); print_r($xml);
|
epsilonion
CLOVEN SKY IMPERIUM.
2
|
Posted - 2011.10.20 21:01:00 -
[8] - Quote
yay ty guys I saw what i did I used https i just took the s out and it works...
i will post working code for other newbies when i have sorted it out and commented it.. :D put it basic terms for people.. :D lmao
thank you all again
been banging my head on the wall for hours lmao
|
epsilonion
CLOVEN SKY IMPERIUM.
2
|
Posted - 2011.10.20 21:34:00 -
[9] - Quote
wont let me post any code now it says i am doing html and i am not lol... :D
|
Dragonaire
Corax. PURgE Alliance
15
|
Posted - 2011.10.21 03:55:00 -
[10] - Quote
Just got to say Yapeal does everything you need and everything ends up in the DB for you to work with. There are many ways around the CLI part in general as well and with some changes that have been made in the last week or so it's even easier now. Download the lastest version and go through the INSTALL.txt and some of the closed issues on the website and if you are still having problems contact me and I'll see what I can do to help you over the humps. Finds camping stations from the inside much easier. Designer of Yapeal for Eve API. Check out the Yapeal forum thread |
|
Desmont McCallock
38
|
Posted - 2011.10.21 11:19:00 -
[11] - Quote
epsilonion wrote:yay ty guys I saw what i did I used https i just took the s out and it works...
i will post working code for other newbies when i have sorted it out and commented it.. :D put it basic terms for people.. :D lmao
thank you all again
been banging my head on the wall for hours lmao
Notice that at some point in time CCP will stop support via HTTP for the API calls. The reason you may not get a proper response when you use HTTPS could be that your root certificates are not up to date to include CCP's certificate.
A related post is available at EVEMon's forum. |
Steve Ronuken
Fuzzwork Enterprises
28
|
Posted - 2011.10.21 12:59:00 -
[12] - Quote
I'd suggest that any time it says it can't parse the xml, you make sure it actually is xml. just use var_dump on $output. |
Frozen Guardian
Registered Amateur Mathematicians
22
|
Posted - 2011.10.22 03:47:00 -
[13] - Quote
epsilonion wrote:yay ty guys I saw what i did I used https i just took the s out and it works...
i will post working code for other newbies when i have sorted it out and commented it.. :D put it basic terms for people.. :D lmao
thank you all again
been banging my head on the wall for hours lmao
Change it back to HTTPS because you're going to need to at some point and put this line in right below the other curl_setopt(s).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
Dragonaire
Corax. PURgE Alliance
15
|
Posted - 2011.10.22 04:04:00 -
[14] - Quote
Yeah go ahead and turn off all the security you get from HTTPS by using curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); Much better option is to just tell curl where to find the up to date certs for Eve servers. If you want I've already extract what you need from FireFox and put it out with Yapeal in the SVN or archives. Just grab the config/eveonline.crt. It's the complete chain for API servers. Finds camping stations from the inside much easier. Designer of Yapeal for Eve API. Check out the Yapeal forum thread |
KnifeOrSpoon
Interstellar Kredits Innovations
0
|
Posted - 2011.10.22 09:08:00 -
[15] - Quote
Personally for all my api cache server development (and the cluster I am working on) I use the following code:
$api_output=file_get_contents($url); // Or substitute for a CURL or Zend Framework alternative $xml_obj=simplexml_load_string($api_output); if(!isset($xml_obj->error)){ // No error detected // Do stuff with the Object }else{ // An error was detected // Implement errorCount and possible cooldown timer for this error } |
Trenker
1
|
Posted - 2011.10.23 15:28:00 -
[16] - Quote
epsilonion wrote:yay ty guys I saw what i did I used https i just took the s out and it works... You should add the s again for security and stability (they may turn off the none SSL way)
The reason why it did not work for you will most likely be an error in cURL which was unable to validate the SSL certificate because the root certificate was missing on your system.
You can bypass this problem by adding the code posted by Frozen Guardian and Dragonaire. This way cURL will accept the SSL certificate without validating it. |
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |