open All Channels
seplocked EVE Technology Lab
blankseplocked Api v2 php request never work...
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

Asteriade
Posted - 2011.01.31 10:13:00 - [1]
 

Hi,

After reading many many tread, i didn't find my answer, so i'm asking here befor begin crazy.
I think about build a web site wich calculat production cost from any manufacture. So i need to use api key of player for getting informations from wallet to get price of tritanium for exemple.

I can't succeed to get this information.

I think i must use CURL with POST but didn't work.

My code is:

-----------------------------------------------------------


function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 40,
CURLOPT_POSTFIELDS => http_build_query($post)
);

$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}


$result = curl_post(
'api.eve-online.com/char/WalletJournal.xml.aspx?',
array(
'userID' => 111111,
'apiKey' => 'ljkbsdlkjbhLKJeklEkjlezlkjelk',
'characterID' => 21111111
)
);

echo $result;

-------------------------------
(Apikey, userid and characterId is fake)


And the result is strange, i only get that:

2011-01-31 08:55:13 2011-01-31 09:49:36

So i don't understand Neutral

Someone could help me please? i would like a code exemple which working

PS: Sorry for my bad english, my birth langage is french


TorTorden
Amarr
Posted - 2011.01.31 11:54:00 - [2]
 

Edited by: TorTorden on 31/01/2011 12:18:56
Edited by: TorTorden on 31/01/2011 12:16:33
Quote:
echo $result;

-------------------------------
(Apikey, userid and characterId is fake)


And the result is strange, i only get that:

2011-01-31 08:55:13 2011-01-31 09:49:36


Those would be the timestamps for when you grabbed it and for how long it's been chached.

Actually I think this means it's working.

Check the source code of the page you are on, assuming you are doing this in a browser, if I just echo the data results from a curl connection like that the actuall xml is tucked away in the source code.

try this perhaps, instead of echo$result; it wont be much usefull in itself, but will make it come out in the open at least :P

$xml= new simplexmlelement($result);
echo"<pre>";
print_r($xml);


update:
Since I don't know exactly what you want to do with the data, here are some example code to put the xml data into a standard html table, Not pretty but data doesn't have to be pretty to be beautifulWink

$doc= new simplexmlelement($crl_data);

echo"<table><tr>";
$rowset=$doc->result->rowset->attributes();
$table_headers=(string)$rowset['columns'];
$table_headers=str_replace(",","<th>",$table_headers);

echo"<th>$table_headers</tr>";
foreach($doc->result->rowset->row AS $a)
{
echo"<tr>";
$b=$a->attributes();
foreach($b as $c)
{
echo"<td>$c";
}
echo"</tr>";
}
echo"</table>";


And simplexml php manual

neutrinone
Posted - 2011.01.31 13:26:00 - [3]
 

Ok, thx very much for your answerd, i guess i understand.
I will try it soon
thx again Very Happy

Asteriade
Posted - 2011.01.31 13:29:00 - [4]
 

ops Neutrinone it's me

Asteriade
Posted - 2011.01.31 15:01:00 - [5]
 

I tryed many many way for outpout or echo or print my xml but i didn't succeed.
the best i can get is:

SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 2
)

[currentTime] => 2011-01-31 14:47:30
[result] => SimpleXMLElement Object
(
[rowset] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => transactions
[key] => refID
[columns] => date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,argName1,argID1,amount,balance,reason,taxReceiverID,taxAmount
)

)

)

[cachedUntil] => 2011-01-31 14:52:56
)


Someone could give me please, the right syntaxe for echo my xml ?

Thebriwan
LUX Uls Xystus
Posted - 2011.01.31 15:42:00 - [6]
 

Edited by: Thebriwan on 31/01/2011 15:42:57
Hello!

Just answering from work, BUT you can not echo/print xml at all!
Because the XML is interpreted by your browser.

You have to look at the source of the page for checking if the xml is there (in Firefox use right-click and "show source" or something like this (in German it is called "Seitenquelltext anzeigen"))

SimpleXML is the right thing to do, but you have to traverse into the nodes.

Asteriade
Posted - 2011.01.31 16:57:00 - [7]
 

Thx Thebriwan for your answer.

So, in deed, i have xml in the code source, but empty:


<pre>SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 2
)

[currentTime] => 2011-01-31 16:53:46
[result] => SimpleXMLElement Object
(
[rowset] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => transactions
[key] => refID
[columns] => date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,argName1,argID1,amount,balance,reason,taxReceiverID,taxAmount
)

)

)

[cachedUntil] => 2011-01-31 17:20:46
)
<?xml version="1.0" encoding="UTF-8"?>
<eveapi version="2">
<currentTime>2011-01-31 16:53:46</currentTime>
<result>
<rowset name="transactions" key="refID" columns="date,refID,refTypeID,ownerName1,ownerID1,ownerName2,ownerID2,argName1,argID1,amount,balance,reason,taxReceiverID,taxAmount"/>
</result>
<cachedUntil>2011-01-31 17:20:46</cachedUntil>
</eveapi>

I feel close, but i really don't know yet how could i get info in xml on variable php :p

it must be possible

Catari Taga
Centre Of Attention
Middle of Nowhere
Posted - 2011.01.31 21:01:00 - [8]
 

Nothing wrong with your php (except you'll want to use HTTPS from now on) or the xml, but it looks like your char did not have any transactions in the last month.

neutrinone
Posted - 2011.01.31 23:34:00 - [9]
 

Ok thx again :)

I think about bug with api key beceause, my caractere have a lot of transaction in game.
I will try to ask another key

Asteriade
Posted - 2011.02.01 15:51:00 - [10]
 

Edited by: Asteriade on 12/02/2011 19:09:38
Ok now, it's working well

I resum here if someone could need it:

function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 40,
CURLOPT_POSTFIELDS => http_build_query($post)
);

$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}


$result = curl_post(
'api.eve-online.com/char/WalletJournal.xml.aspx?',
array(
'userID' => 246546,
'apiKey' => 'MXdvsrvdsfvdsfvbdsftgvwLqNg1u',
'characterID' => 1621836047,
'rowCount' => 256
)
);


$xml= new SimpleXMLElement($result);


$bob = $xml->result->rowset[0]->row[6][ownerName1];
echo $bob;


---------------------------------

So $bob echo the line 6 owner name info from wallet


Thx everyone !

Catari Taga
Centre Of Attention
Middle of Nowhere
Posted - 2011.02.01 15:58:00 - [11]
 

You might want to edit your post and change your API key. Wink

Asteriade
Posted - 2011.02.12 19:10:00 - [12]
 

ops
Thx

Asteriade
Posted - 2011.02.12 19:23:00 - [13]
 

DAMN, someone took my api key, and there is this message !!!





Declaration of War
From: CrazyEye Logan
Sent: 2011.02.12 19:13
To: Asteriade,

Hello Asteriade,

I've taken advantage of your thread where you posted your API keys - and now I'm going to blackmail you :)
Since 1st of February I downloaded all your API informations and followed your progress.

I know, what you own and where your items are.
I know your skills stats and your mailing correspondence.

I know the location of your DG Tower in Gelfiven and I know which modules are attached. That you store your Tengu, your Raven and other ships there.
I know what you currently research, what you invent and your overall invention chance.
I know, where you sell your goods and how much profit your make off them.

I know that you tried to scam with your alt 'Aste Bis'. I have all the recipients of your mail. You aren't going back to 0.0!

I know, you flew in 0.0 and only a few of your old comrades are still on your contact list.
I know, that you have recently been killed in Rancer, but who wasn't :-)

I've watched you in game and I know, where you do missions and where you rat or mine.
I know your recent flight routes and - for some - I know why you did them.


Anyway, assessing your assets, you have around 5.2 billion in cash, about 10 billion in assets and another 2-3 billions in blueprints (depending on how much your T2 bpcs are rated).

The deal is: 1 billion to my account and the compiled data will be destroyed and the war dec cancelled - a rather small sum for your own errors.
Zero ISK in my account and me and my associates will execute the war on you, put your tower into reinforced mode and camp it until we can shoot at the ship hangar and the labs.
Going public with the dossier about you and your corporation on C&P will also be a fun act.


You have 24 hours. If you decide to unanchor your tower, a) your research will be lost and b) I - or someone else - will be there and gank you.


Regards,
Logan


P.S: EVE is a cool game, isn't it?
P.P.S: remove your API keys from the board!

Asteriade
Posted - 2011.02.12 19:27:00 - [14]
 

lol

by the way, i never scam anybody.

Catari Taga
Centre Of Attention
Middle of Nowhere
Posted - 2011.02.12 19:45:00 - [15]
 

Cute.

CrazyEye Logan
Angel Cartel Administration
Posted - 2011.02.12 20:13:00 - [16]
 

Originally by: Asteriade
lol

by the way, i never scam anybody.


Originally by: Aste Bis
Mail title: Raven Navy Issue CHEAP PRICE
Mail sent: 2010-06-12 16:46:00

Hey ! I am moving to 0.0 today and I'm selling all the ships I can't carry it with me.

Convo me if interested.

i still have Raven Navy Issue x2 375m
Right ...

Asteriade
Posted - 2011.02.12 23:21:00 - [17]
 

fake, it's not my tip.

I think you bluff crazyeyes, but just in case,i get out my POS all big stuff

Catari Taga
Centre Of Attention
Middle of Nowhere
Posted - 2011.02.12 23:34:00 - [18]
 

You guys should probably take the finger pointing to C&P, you'll find a more appreciative audience there. Wink

Rhaven
Quiet.Storm
Posted - 2011.02.13 04:56:00 - [19]
 

SO change your API key easy enough...

Originally by: Asteriade
DAMN, someone took my api key, and there is this message !!!





Declaration of War
From: CrazyEye Logan
Sent: 2011.02.12 19:13
To: Asteriade,

Hello Asteriade,

I've taken advantage of your thread where you posted your API keys - and now I'm going to blackmail you :)
Since 1st of February I downloaded all your API informations and followed your progress.

I know, what you own and where your items are.
I know your skills stats and your mailing correspondence.

I know the location of your DG Tower in Gelfiven and I know which modules are attached. That you store your Tengu, your Raven and other ships there.
I know what you currently research, what you invent and your overall invention chance.
I know, where you sell your goods and how much profit your make off them.

I know that you tried to scam with your alt 'Aste Bis'. I have all the recipients of your mail. You aren't going back to 0.0!

I know, you flew in 0.0 and only a few of your old comrades are still on your contact list.
I know, that you have recently been killed in Rancer, but who wasn't :-)

I've watched you in game and I know, where you do missions and where you rat or mine.
I know your recent flight routes and - for some - I know why you did them.


Anyway, assessing your assets, you have around 5.2 billion in cash, about 10 billion in assets and another 2-3 billions in blueprints (depending on how much your T2 bpcs are rated).

The deal is: 1 billion to my account and the compiled data will be destroyed and the war dec cancelled - a rather small sum for your own errors.
Zero ISK in my account and me and my associates will execute the war on you, put your tower into reinforced mode and camp it until we can shoot at the ship hangar and the labs.
Going public with the dossier about you and your corporation on C&P will also be a fun act.


You have 24 hours. If you decide to unanchor your tower, a) your research will be lost and b) I - or someone else - will be there and gank you.


Regards,
Logan


P.S: EVE is a cool game, isn't it?
P.P.S: remove your API keys from the board!


Asteriade
Posted - 2011.02.13 07:45:00 - [20]
 

sur, i did just after


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only