Advertisement
Fuzzysteve

api key info

Aug 28th, 2013
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1.     <?php
  2.             if(!isset($_GET['keyID']) || empty($_GET['keyID']))
  3.             {
  4.                     echo "keyID is not set or is empty";
  5.                     return;
  6.             }
  7.  
  8.             if(!isset($_GET['vCode']) || empty($_GET['vCode']))
  9.             {
  10.                     echo "keyID is not set or is empty";
  11.                     return;
  12.             }
  13.  
  14.             // create curl resource
  15.             $ch = curl_init("https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyID=" . $_GET['keyID'] . "&vCode=" . $_GET['vCode']);
  16.  
  17.             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18.             curl_setopt($ch, CURLOPT_HEADER, 0);
  19.  
  20.             // $response contains the XML response string from the API call
  21.             $response = curl_exec($ch);
  22.  
  23.             // If curl_exec() fails/throws an error, the function will return false
  24.             if($response === false)
  25.             {
  26.                     // Could add some 404 headers here
  27.                     echo 'Curl error: ' . curl_error($ch);
  28.             }
  29.             else
  30.             {
  31.                     $apiInfo = new SimpleXMLElement($response);
  32.  
  33.                     $accessMask = (int)$apiInfo->result->key->attributes()->accessMask;
  34.                     // Echo back the accessMask as a response
  35.                     echo $accessMask;
  36.             }
  37.  
  38.             // close curl resource to free up system resources
  39.             curl_close($ch);
  40.  
  41.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement