These forums have been archived and are now read-only.
The new forums are live and can be found at https://forums.eveonline.com/
PHP CREST & ESI
Class eveOnline{ function sso($code, $grantType = 'authorization_code'){ $secretKey = "XXXXXXXXXXXXXXXXXXXXXXXXX"; //Edited out for post $clientID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //Edited out for post if ($code){ $base64 = base64_encode("$clientID:$secretKey"); $url = 'https://login.eveonline.com/oauth/token'; $data = array('grant_type' => $grantType, 'code' => $code); $options = array( 'http' => array( 'header' => "Authorization: Basic ".$base64."\r\n". "Content-type: application/x-www-form-urlencoded\r\n". "Host: login.eveonline.com\r\n", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); //Send Data $result = file_get_contents($url, false, $context); //Receive Data if (isset($result)){ $jsonData = json_decode($result, true); } } return $jsonData; } function cData($endPointURL, $access_token){ $options = array( 'http' => array( 'header' => "Authorization: Bearer ".$access_token."\r\n". "Accept: application/vnd.ccp.eve.RegionCollection-v1+json". "Host: $endPointURL\r\n", 'method' => 'GET', ), ); $context = stream_context_create($options); //Send Data $result = file_get_contents($endPointURL, false, $context); //Receive Data if (isset($result)){ $jsonData = json_decode($result, true); } return $jsonData; }}
function cData($endPointURL, $access_token){ $header = array('Authorization: Bearer '.$access_token, 'Content-Type: application/json'); $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $endPointURL, CURLOPT_HTTPHEADER => $header )); $return_data = curl_exec($ch); curl_close($ch); return $return_data;}