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.
 

Problems with posted api variables

Author
stu2000
Perkone
Caldari State
#1 - 2012-07-15 13:51:10 UTC  |  Edited by: stu2000
Hello all!

Unfortunately, I'm having difficulty with my PHP script retrieving information from the api with the new api key details

The api keeps giving me the following error:

Quote:
Must provide userID or keyID parameter for authentication.



Now before you say "Duh! you need to provide the userID or keyID", I am.
I have tried two techniques that both fail. The first of which actually works with the legacy api keys.

The first relies on _GET functionality and is done by just appending the variables at the end with ?keyID=xxx&vCode=yyy

Quote:
$base_url = "http://api.eve-online.com";
$sub_url = "/account/Characters.xml.aspx";

$full_url = $base_url . $sub_url . "?keyID=xxx&vCode=yyy";

$content = file_get_contents($full_url);
print $content;


The second technique I have tried is with using cURL using the following function

Quote:
function sendRequest($params, $sub_url)
{
$base_url = "http://api.eve-online.com";
$full_url = $base_url . $sub_url;

$query_string = "";
foreach ($params as $key => $value)
{
$query_string .= $key . "=" . urlencode($value) . "&";
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $full_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$response = curl_exec($ch);
if (curl_error($ch))
{
die("Connection Error: " . curl_errno($ch) . ' - ' . curl_error($ch));
}

curl_close($ch);

echo $response;
}


with $params passed in as
$params = array('keyID' => 'xxx',
'vCode' => 'yyy');


Neither is working for me. Is anyone else experiencing the same issue? I have triple checked the values of my keyID
Desmont McCallock
#2 - 2012-07-15 14:45:51 UTC
Try using "https://api.eveonline.com" instead.
stu2000
Perkone
Caldari State
#3 - 2012-07-17 20:49:19 UTC
I swear i quadruple checked this but it turns out i had two of my arguments the wrong way round. Sorry to waste everyones time. Thread solved