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.
 

CREST (PHP/Curl) Basic Examples

Author
Kelath Erebus
Federal Navy Academy
Gallente Federation
#1 - 2016-02-02 07:10:23 UTC  |  Edited by: Kelath Erebus
Evening,

I started this thread with a headache and thought I'd share what ended up working for me, here are a couple examples. Please note they are very basic, but hopefully they will help some of you trying to figure out CREST.

Cheers!
Kelath
Kelath Erebus
Federal Navy Academy
Gallente Federation
#2 - 2016-02-02 08:21:08 UTC
Update:

The following works:


        $header = 'Authorization: Bearer ' . Sessions::$aSession['authToken'];

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://crest-tq.eveonline.com/regions/");
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $result = json_decode($result);
        print_r( $result );
        curl_close($ch);
Kelath Erebus
Federal Navy Academy
Gallente Federation
#3 - 2016-02-02 08:24:27 UTC
For reference for others:

This is how to pull character fittings, keep in mind this is as basic as it goes...


        $header = 'Authorization: Bearer ' . Sessions::$aSession['authToken'];

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://crest-tq.eveonline.com/characters/".Sessions::$aSession['userID'].'/fittings/');
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $result = json_decode($result);
        print_r( $result );
        curl_close($ch);
Kelath Erebus
Federal Navy Academy
Gallente Federation
#4 - 2016-02-02 08:38:05 UTC
Last couple and I think you can figure out the rest:

Character Location:

        $header = 'Authorization: Bearer ' . Sessions::$aSession['authToken'];

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://crest-tq.eveonline.com/characters/".Sessions::$aSession['userID'].'/location/');
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $result = json_decode($result);
        print_r( $result );
        curl_close($ch);


Character endpoints:

        $header = 'Authorization: Bearer ' . Sessions::$aSession['authToken'];

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://crest-tq.eveonline.com/characters/".Sessions::$aSession['userID'].'/');
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array($header));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $result = json_decode($result);
        print_r( $result );
        curl_close($ch);
David Davaham
Deep Blue Logistics
#5 - 2016-02-07 23:26:41 UTC
Would these methods work for utilizing the SSO for example. I messed around with that a few months ago, but I could not for the life of me get it working so I gave up. I am working on a project right now that could really benefit from something like the SSO.

Developer of EVEmail

Yogi Berimor
Monkey Attack Squad
Goonswarm Federation
#6 - 2016-02-11 21:30:39 UTC
David Davaham wrote:
Would these methods work for utilizing the SSO for example. I messed around with that a few months ago, but I could not for the life of me get it working so I gave up. I am working on a project right now that could really benefit from something like the SSO.

Actually it's quite easy to set up. Have a look at my thread and ping me if you have any questions.