| Author |
Thread Statistics | Show CCP posts - 0 post(s) |

Lem2J
Black Sea Industries Insurgency
|
Posted - 2008.03.30 19:29:00 -
[1]
Edited by: Lem2J on 30/03/2008 19:34:48 Hey guys, im new to all of this, but im trying to put a class together in Php to speak with the API.. Hwere what i have so far:
<?php
class eveApi { var $api_userid = "123"; var $api_key = "123"; var $api_charid = "781335233"; var $api_root = "api.eve-online.com";
var $head; var $auth;
function apiRequest() { $fp = fsockopen ('api.eve-online.com', 80, $errno, $errstr, 30); if (!$fp) return "meh! Eve server is such a n00b'ette! ".$errstr;
fputs($fp, $this->head); fputs($fp, $this->auth);
$data=''; while (!feof($fp)) { $data.=fgets($fp,128); }
fclose ($fp);
$start = '<eveapi'; $end = '</eveapi>'; $null = eregi("$start(.*)$end", $data, $stuff);
return $stuff[0]; }
function starbaseList() { $this->head = "POST /corp/StarbaseList.xml.aspx HTTP/1.0\r\n"; $this->head .= "Host: api.eve-online.com\r\n"; $this->head .= "Content-Type: application/x-www-form-urlencoded\r\n"; $this->head .= "Content-Length: " . strlen($auth) . "\r\n"; $this->head .= "Connection: close\r\n\r\n";
$this->auth = "apiKey=" . $this->api_key; $this->auth .= "&characterID=". $this->api_charid; $this->auth .= "&userID=" . $this->api_userid;
print $this->apiRequest(); } } ?>
-----------
<?php
require_once('library/eve-api.class.php'); $api = new eveApi;
$stuff = $api->starbaseList(); print $stuff;
?>
For some reason, i am getting the error: 2008-03-30 19:32:53 Must provide userID parameter for authentication. 2008-03-30 19:37:53
As far as i can see, the correct details have been passed? Any help would be great :).
|

Lem2J
Black Sea Industries Insurgency
|
Posted - 2008.03.30 22:14:00 -
[2]
You make some good points :p.. However id still like to understand why this wont work. As far as i can see, it should.
|

Lem2J
|
Posted - 2008.03.30 22:39:00 -
[3]
Yea its deffo the full API key
|

Lem2J
Black Sea Industries Insurgency
|
Posted - 2008.03.30 23:32:00 -
[4]
Yep to both
|

Lem2J
Black Sea Industries Insurgency
|
Posted - 2008.03.31 10:19:00 -
[5]
Cheers :/ cant believe i missed that
|
| |
|