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.
 

CURL response

First post
Author
Leoric Firesword
Imperial Shipment
Amarr Empire
#1 - 2014-08-03 15:31:43 UTC  |  Edited by: Leoric Firesword
Trying to utilize the API for the first time, I'm using PHP 5.4 on a shared web host.

I'm using the example from https://neweden-dev.com/Eve_API_Example_-_Raw_PHP just plugging in my key and vcode.

when I grab the url and browse to it I get the page I'd expect

when running this page I get a simple xml error. I've been trying to verify exactly what is coming back from my curl call by echoing the response, and using print_r for the response but they just return nothing or blank.

I've also taken out curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); because it should spew the curl results back onto the page, just getting a blank page.

any help to what I could look at would be greatly appreciated.

EDIT:

got it returning what I wanted with file_get_contents, is this an ok method for using the API?
Wafflehead
Garoun Investment Bank
Gallente Federation
#2 - 2014-08-03 16:33:29 UTC
Yes you can use the file_get_contents and then simply use the SimpleXMLElement for parsing the data.

For the CREST data you will need to use json_decode instead.
Johnathan Roark
Quantum Industries
#3 - 2014-08-03 19:10:49 UTC
Some shared host block file_get_contents with remote files.

As for your curl issue, try var_dump(). Sometimes it gives more info.

EVEVERIFY - A recruiting API Verification and Audit Tool

Also try out Yapeal for your php api needs

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#4 - 2014-08-03 20:27:49 UTC  |  Edited by: Steve Ronuken
Leoric Firesword wrote:
Trying to utilize the API for the first time, I'm using PHP 5.4 on a shared web host.

I'm using the example from https://neweden-dev.com/Eve_API_Example_-_Raw_PHP just plugging in my key and vcode.

when I grab the url and browse to it I get the page I'd expect

when running this page I get a simple xml error. I've been trying to verify exactly what is coming back from my curl call by echoing the response, and using print_r for the response but they just return nothing or blank.

I've also taken out curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); because it should spew the curl results back onto the page, just getting a blank page.

any help to what I could look at would be greatly appreciated.

EDIT:

got it returning what I wanted with file_get_contents, is this an ok method for using the API?



It's /possible/ that you don't have curl installed.

take a look at the outcome of phpinfo();




Edit:

http://stackoverflow.com/questions/2107759/php-file-get-contents-and-headers is useful, with regards to setting a useragent (which is just good practice, and keeps the devs happier)

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Leoric Firesword
Imperial Shipment
Amarr Empire
#5 - 2014-08-03 23:27:53 UTC
curl is installed, at least phpinfo() says it is. will look into setting my useragent