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] SSO retrieve the token
function retrieveToken(){ $header = 'Authorization: Basic ' . base64_encode($_SESSION['clientid'] . ':' . $_SESSION['clientsecret']); $fields_string = ''; $fields = array( 'grant_type' => 'authorization_code', 'code' => $_GET['code'] ); foreach ($fields as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); // Build Http query using params $query = http_build_query ($fields); // Create Http context details $contextData = array ( 'method' => 'POST', 'header' => "Connection: close\r\n". "Content-Length: ".strlen($query)."\r\n", 'content'=> $query ); // Create context resource for our request $context = stream_context_create (array ( 'https' => $contextData )); // Read page rendered as result of your POST request $result = file_get_contents ( 'https://login.eveonline.com/oauth/token', // page url false, $context); echo $result; }
$contextData = array ( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . $header . "\r\n", 'content'=> $query );
EsiPy - Python 2.7 / 3.3+ Swagger Client based on pyswagger for ESI