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.
 

FIXED: php returns errors when calling apis ... no idea why

Author
Eduardo'o
Ministry of War
Amarr Empire
#1 - 2013-01-06 14:13:12 UTC  |  Edited by: Eduardo'o
First and for all, this has worked for years and now all of a sudden no longer


$ch = curl_init();
$calledUrl = "http://api.eve-online.com/eve/CharacterName.xml.aspx?IDs=xxxxxxxxxxx";

echo "Call: ".$calledUrl."";

curl_setopt($ch, CURLOPT_URL, $calledUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
echo "Res: ";
print $res;
curl_close($ch);

It is supposed to retrieve the character name for a given character id.
I return the generated url and if i call it directly in a browser it returns the expected results, but if i do it through php, my $res is empty !


It used to work until a few months ago and since then it does not return anything anymore. Anyone has an idea why not?

E
Wafou Ka'Djo
Yellow Box Ltd.
#2 - 2013-01-06 15:00:10 UTC
I'm far from an expert but I think the problem is in the URL. Now it's under secure connection so it's https://api.eveonline.com , http requests don't work anymore.
xDohmenx
Caldari Provisions
Caldari State
#3 - 2013-01-06 15:37:54 UTC
As Wafou said, try switching to HTTPS. Also is it using the new verification method, or the old one? The new one (came out a while ago, but I dont know your meaning of a couple of months) requires a different verification method.

keyID - user id
vCode - verification code
Nix Anteris
The Dark Space Initiative
Scary Wormhole People
#4 - 2013-01-06 16:56:03 UTC
If you use HTTP it will actually redirect you to HTTPS

If your version of PHP does not have OpenSSL support, the request will subsequently fail. You should get a nice informative error in your logs if this is the case.

You do log errors, right? Right?
Eduardo'o
Ministry of War
Amarr Empire
#5 - 2013-01-06 18:39:47 UTC
xDohmenx wrote:
As Wafou said, try switching to HTTPS. Also is it using the new verification method, or the old one? The new one (came out a while ago, but I dont know your meaning of a couple of months) requires a different verification method.

keyID - user id
vCode - verification code

this api does not require this
Eduardo'o
Ministry of War
Amarr Empire
#6 - 2013-01-06 18:43:18 UTC
Nix Anteris wrote:
If you use HTTP it will actually redirect you to HTTPS

If your version of PHP does not have OpenSSL support, the request will subsequently fail. You should get a nice informative error in your logs if this is the case.

You do log errors, right? Right?


It simply does not return anything

How can i check if my version of php is supporting OpenSSL?
Desmont McCallock
#7 - 2013-01-06 20:28:58 UTC
Eduardo'o wrote:
xDohmenx wrote:
As Wafou said, try switching to HTTPS. Also is it using the new verification method, or the old one? The new one (came out a while ago, but I dont know your meaning of a couple of months) requires a different verification method.

keyID - user id
vCode - verification code

this api does not require this

Be as stubborn as you want, but you better switch to HTTPS and 'api.eveonline.com'.
Eduardo'o
Ministry of War
Amarr Empire
#8 - 2013-01-06 20:48:38 UTC
Desmont McCallock wrote:
Eduardo'o wrote:
xDohmenx wrote:
As Wafou said, try switching to HTTPS. Also is it using the new verification method, or the old one? The new one (came out a while ago, but I dont know your meaning of a couple of months) requires a different verification method.

keyID - user id
vCode - verification code

this api does not require this

Be as stubborn as you want, but you better switch to HTTPS and 'api.eveonline.com'.


That fixed it !

The https did not do it, but the eveonline instead of eve-online in the url did fix it. I did not even see i had that wrong :)
Kelath Erebus
Federal Navy Academy
Gallente Federation
#9 - 2013-01-06 22:24:25 UTC
Just take the raw URL you're attempting to submit via curl and put it into the browser, once you have it pulling up in the browser use that URL for CURL, if it pulls up fine in the browser then you're having an issue with CURL.
Peter Powers
Terrorists of Dimensions
HORSE-KILLERS
#10 - 2013-01-07 08:19:36 UTC
you could save yourself alot of trouble by using one of the API libraries for PHP,
for example PhealNG ;)

3rdPartyEve.net - your catalogue for 3rd party applications