Fix for API via https

EDK releases + Open discussion and chat about EDK.
User avatar
Salvoxia
Developer
Posts: 1598
Joined: Wed Feb 22, 2012 12:11

Fix for API via https

Post by Salvoxia »

\o mates,

as of today CCP disabled the legacy URL http://api.eveonline.com for access the API (see news item http://community.eveonline.com/news/new ... -in-effect) . From now on you MUST use https://api.eveonline.com

EDK uses pheal for access the api which offers a nice and easy way to switch to https. If you don't do this, your killboard wont be able to fetch anything from the API, not even kills, but also corporation and alliance details.
You know that your killboard is affected if you see PHP Warnings like Invalid argument supplied for foreach() when viewing a Corp's or Alliance's detail page (only non-cached) or if you visit the API KillLog site on the admin menu.
Also, in your pheal error log (can be found in cache/api/pheal_error.log) you will find lines like this at the end of the file:

Code: Select all

Wed, 17 Oct 2012 16:04:11 +0200 [GET] 0.0505s http://api.eveonline.com/eve/AllianceList.xml.aspx "0: String could not be parsed as XML"
Here's what you have to do get your killboard running again:
Connect to your FTP server and find the following file in the killboard folder:
common/pheal/PhealConfig.php
In this file find the following line of code (around line 60):

Code: Select all

public $api_base = "http://api.eveonline.com/";
and replace it with this line (or simply add the "s" to "http"):

Code: Select all

public $api_base = "https://api.eveonline.com/";
That should do the trick. Thanks to two step for this better solution.
Propably you have to clear your API cache (Admin Panel -> button "Clear cache")

If you still get errors, take another look in your pheal_error.log.
If it says somethin like

Code: Select all

Wed, 17 Oct 2012 15:44:46 +0200 [GET] 0.0311s https://api.eveonline.com/eve/AllianceList.xml.aspx "60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"
Then you have three options:
  • You know what this means, and you know how to fix it
  • Go and ask your provider to do an update to the CA cert bundle to inlcude the RapidSSL Root CA
  • Disable certificate verification, which is the easiest way, but somewhat kills the advantage of SSL.
If you want to go with option 3, open the file common/pheal/Pheal.php and find these lines :

Code: Select all

        // curl defaults
        curl_setopt(self::$curl, CURLOPT_URL, $url);
        curl_setopt(self::$curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt(self::$curl, CURLOPT_RETURNTRANSFER, true);
After these append:

Code: Select all

        curl_setopt(self::$curl,CURLOPT_SSL_VERIFYHOST,0);
 	curl_setopt(self::$curl,CURLOPT_SSL_VERIFYPEER,0);

GL fixing your killboards.


Regards,
Salvoxia
Last edited by Salvoxia on Fri Apr 26, 2013 07:31, edited 6 times in total.

Satre
Noob
Posts: 6
Joined: Wed Apr 08, 2009 11:20

Re: Fix for API via https

Post by Satre »

thanx :D

User avatar
AndyTibs
Greenhorn
Posts: 35
Joined: Fri Sep 10, 2010 04:13

Re: Fix for API via https

Post by AndyTibs »

fixed! thanks!

twostep
Greenhorn
Posts: 25
Joined: Fri Oct 01, 2010 18:53

Re: Fix for API via https

Post by twostep »

Another option, which I think is a better fix, is to change the api_base in common/pheal/PhealConfig.php to this:

Code: Select all

    public $api_base = "https://api.eveonline.com/";
(just add the s to http)

Bamse
Greenhorn
Posts: 11
Joined: Tue Oct 05, 2010 16:34

Re: Fix for API via https

Post by Bamse »

Salvoxias fix working perfectly on my killboard.
cudoz and many many thanks!

deanmrd
Greenhorn
Posts: 23
Joined: Sat Jun 14, 2008 20:24

Re: Fix for API via https

Post by deanmrd »

Worked for me too

Redhouse
Apprentice
Posts: 46
Joined: Sun Mar 18, 2012 17:12

Having problems

Post by Redhouse »

I have made all of the changes indicated including http_ssl_verifypeer = false; but there is still an error thrown. I have cleared the cache and I'm running 4.0.4. The error in pheal_error.log for me is not the #60, but #77 as follows:

Code: Select all

Wed, 17 Oct 2012 18:06:37 -0700 [GET] 0.1099s https://api.eveonline.com/eve/CharacterID.xml.aspx?names=SOMEGUY "77: Problem with the SSL CA cert (path? access rights?)"
I really don't know what causes this, or where the error code is actually coming from. If someone can help I'd appreciate it.
Thanks.

Darferan
Noob
Posts: 2
Joined: Thu Oct 18, 2012 05:34

Re: Fix for API via https

Post by Darferan »

After i had done the above i was still getting the error 60, probably caused by me not having curl set up properly with a ca-certificate bundle.

This article explained a work around

http://davidwalsh.name/php-ssl-curl-error

the file you want is actually here (right click the link and save as)

http://curl.haxx.se/ca/cacert.pem

save that file and name it mozilla.pem, I placed mine in my PHP folder

i had to add one line to my pheal.php in the common\pheal folder

i found this block at line 317 in pheal.php

Code: Select all

        // curl defaults
        curl_setopt(self::$curl, CURLOPT_URL, $url);
        curl_setopt(self::$curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt(self::$curl, CURLOPT_RETURNTRANSFER, true);
I added the following after the above block

Code: Select all

        curl_setopt(self::$curl, CURLOPT_CAINFO,'D:\Server\PHP\mozilla.pem');    
The D:\Server\PHP\mozilla.pem is is the file i downloaded from the above link and named mozilla.pem and saved it in my PHP folder


This fixed my issue, but i self host and i did not have a ca-root bundle in my php distro, secondly i'm running windows

Fire Puh
Greenhorn
Posts: 17
Joined: Sat Jul 16, 2011 14:51

Re: Fix for API via https

Post by Fire Puh »

Salvoxia, thanks!

User avatar
Senya
Greenhorn
Posts: 21
Joined: Thu May 17, 2012 15:09
Location: RUSSIA
Contact:

Re: Fix for API via https

Post by Senya »

All works THANKS! 8-)

Post Reply