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.
 

walletjournal.xml api help needed badly, calling all guru's

Author
Atomic Hedgehog
Deep Core Mining Inc.
Caldari State
#1 - 2013-08-16 11:02:41 UTC  |  Edited by: Atomic Hedgehog
Ok I have been searching all over for any way that works..and i think im close but im now stuck..so sending out a plea to all the api code gurus that have figured this out already.

How did you get your walletjournal.xml to work, and how did u successfully upload it into a mysql database?

this is the script i've been testing wtih and I've got the database connection stuff working, but im unable to properly parse the xml and insert it into the database, im getting errors about the foreach statement not giving proper arguments..any and all help greatly appreacited thank you.

--- removed the php starting tag, forum dosnt like it

error_reporting(E_ALL);

include "connection.php"; // this works perfectly, no problems connecting to mysql, or the db

$keyID = "something" ;
$vcode= "something";
$characterID= "something";

$url = "https://api.eveonline.com/char/WalletJournal.xml.aspx?keyID=$keyid&Vcode=$vcode&characterID=$characterID";

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE):
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE):

$data = curl_exec($ch);

curl_close($ch);

$doc = new SimpleXmlElement($data, LIBXML_NODATA);

foreach ( $doc -> result -> rowset -> row as $row )
{
$datee = $row ['date']';
$refID = $row ['refid']'
$refTypeID = $row ['refTypeID'];
$ownerName1 = mysql_real_escape_string($row['ownerName1']);
$ownerID1 = $row['ownerID1'];
$ownerName2 = mysql_real_escape_string($row['ownerName2']);
$ownerID2 = $row['ownerID2'];
$argName1 = $row['argName1'];
$argID1 = $row['argID1'];
$amount = $row['amount'];
$balance = $row['balance'];
$reason = $row['reason'];

$time = strtotime('- 30 minute',$datee);
echo $time;
/if the date is within the last 30 minutes
if($datee >= $time)
{
if($ownerName1 != '$exclude_char')
{
$precheck = mysql_query("SELECT refID FROM walletJournal WHERE date = '$datee', AND amount = '$amount'");
$precheck2 = mysql_num_rows($precheck);

if($precheck2['refID'] < 1)
{
mysql_query("INSERT INTO walletJournal (date, refID, refTypeID, ownerName1, ownerID1, ownerName2, ownerID2, argName1, argID1, amount, balance, reason) VALUES ('$datee', '$refID', '$refTypeID', '$ownerName1', '$ownerID1', '$ownerName2', '$ownerID2', '$argName1', '$argID1', '$amount', '$balance', '$reason')")or die(mysql_error());
}
}
}

}

--- removed php ending tag, forum dosnt like it
Louis Vitton
Viziam
Amarr Empire
#2 - 2013-08-16 11:21:22 UTC
have you looked at yapeal? http://wiki.eve-id.net/Yapeal
or alternatively phealING http://github.com/3rdpartyeve/phealng/

Yapeal will load the data into a database for you and does the leg work of ensuring cache timer is not breached.
Its as simple as your sql querys to pull the data out.
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#3 - 2013-08-16 11:47:15 UTC
Louis is entirely right. Use one of the frameworks to do the heavy lifting for you. Makes life a lot easier.

Aside from that:

Look into using PDO. Or little Bobby Tables might come along and drop your database.

Did you mean NODATA, or NOCDATA


If you're ever wondering about the data you're getting back, var_dump() is your friend.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Innominate
KarmaFleet
Goonswarm Federation
#4 - 2013-08-16 12:00:57 UTC
Please please please please please do not use mysql_* functions, they are old, and unsafe and your code is highly exploitable.

Please look into PDO and prepared statements.

http://us2.php.net/manual/en/pdo.prepared-statements.php
Atomic Hedgehog
Deep Core Mining Inc.
Caldari State
#5 - 2013-08-16 20:08:23 UTC
I looked into several different frameworks but couldnt get any of them to work, either they are no longer supported, or they required extra stuff my hosting provider dosnt allow for.

So I'll have to continue working with what I have.

anyone else actually have a walletjournel working without using one of the frameworks ???

yes I realize some of the calls in the code are outdated and insecure now, but that isn't a concern for what this application is designed for, I just simply want to get something working for testing purposes.
ItsmeHcK1
Immortalis Inc.
Shadow Cartel
#6 - 2013-08-16 22:23:40 UTC
Well, for one you misspelled the variable name...
Atomic Hedgehog wrote:
$keyID = "something" ;
$vcode= "something";
$characterID= "something";

$url = "https://api.eveonline.com/char/WalletJournal.xml.aspx?keyID=$keyid&Vcode=$vcode&characterID=$chracterID";

Also, the actual error might be helpful.
Ydnari
Estrale Frontiers
#7 - 2013-08-16 22:39:46 UTC
Quote:

$characterID= "something";

$url = "https://api.eveonline.com/char/WalletJournal.xml.aspx?keyID=$keyid&Vcode=$vcode&characterID=$chracterID";


Turn your error level reporting up further, you've misspelled the variable.

Then delete this code and use PhealNG.

--

Atomic Hedgehog
Deep Core Mining Inc.
Caldari State
#8 - 2013-08-17 02:13:00 UTC
Ydnari wrote:
Quote:

$characterID= "something";

$url = "https://api.eveonline.com/char/WalletJournal.xml.aspx?keyID=$keyid&Vcode=$vcode&characterID=$chracterID";


Turn your error level reporting up further, you've misspelled the variable.

Then delete this code and use PhealNG.


thank you but i do not wish to use additional libraries....i am working on just some simple code to fetch the api, parse it and upload into the mysql database, it shouldnt need to be dependent on all these other libraries thanks though.
Atomic Hedgehog
Deep Core Mining Inc.
Caldari State
#9 - 2013-08-17 02:34:00 UTC
Ydnari wrote:
Quote:

$characterID= "something";

$url = "https://api.eveonline.com/char/WalletJournal.xml.aspx?keyID=$keyid&Vcode=$vcode&characterID=$characterID";


Turn your error level reporting up further, you've misspelled the variable.

Then delete this code and use PhealNG.


the typo there was only from typing it onto the forum, its actually spelled correctly in my script..if i manually post the api query, it returns the xml fine, thats not where im having the problem.
ItsmeHcK1
Immortalis Inc.
Shadow Cartel
#10 - 2013-08-17 12:49:18 UTC
ItsmeHcK1 wrote:
Also, the actual error might be helpful.