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.
 

Need help with API

Author
PyroTech03
Caldari Provisions
Caldari State
#1 - 2012-04-28 19:42:05 UTC
Hello,

I'm new to coding and was having someone help me for a greater portion of this, but it seems they have fallen off the earth so I'm left to my own to get things finished.

I am needing something to parse the XML for the wallet journal.

Current code is this:

Quote:
function saveTags($ccp_parser,$tag,$attributes='') {
global $XML,$TAGS;
$XML .= '<' . $TAGS[$tag];
if ($tag=='ROW') {
$XML .= ' date="' . $attributes['DATE'] . '" refID="' . $attributes['REFID'] . '" refTypeID="' . $attributes['REFTYPEID'] . '" ownerName1="' . $attributes['OWNERNAME1'] . '" ownerID1="' . $attributes['OWNERID1'] . '" ownerName2="' . $attributes['OWNERNAME2'] . '" ownerID2="' . $attributes['OWNERID2'] . '"';
$XML .= ' argName1="' . $attributes['ARGNAME1'] . '" argID1="' . $attributes['ARGID1'] . '" amount="' . $attributes['AMOUNT'] . '" balance="' . $attributes['BALANCE'] . '" reason="' . $attributes['REASON'] . '" taxReceiverID="' . $attributes['TAXRECEIVERID'] . '" taxAmount="' . $attributes['TAXAMOUNT'] . '" /';
}
$XML .= '>';
if ($tag=='CURRENTTIME' || $tag=='CACHEDUNTIL') $XML .= date("Y-m-d H:i:s");


This would work under old api, as the reason code just returned the reason code. but now, wallet journal reason code for player donations returns "DESC: " + the player entered text.

How would I go about removing the "DESC: " from reason codes so that the script picks it up properly?
Desmont McCallock
#2 - 2012-04-28 19:54:30 UTC
Use str_replace on $attributes['REASON'] .
PyroTech03
Caldari Provisions
Caldari State
#3 - 2012-04-28 20:44:03 UTC
So should it work by doing the following right in the middle of the XML parsing?

Quote:
str_replace("", "DESC: ", "$attributes['REASON']")


Or how do you actually declare a "no space" or just remove it?
mxzf
Shovel Bros
#4 - 2012-04-29 00:53:10 UTC
Yeah, you just replace "DESC: " with "" (an empty string), which is the same as just deleting the "DESC: ".
Desmont McCallock
#5 - 2012-04-29 04:59:11 UTC
Actually it should be
Quote:
str_replace("DESC: ", "", $attributes['REASON'])
PyroTech03
Caldari Provisions
Caldari State
#6 - 2012-04-29 23:24:27 UTC
Ok thanks guys!

One more question then....

better to do it inside the xml parse bit (what I linked there) or do a seperate call after it's all been finished and run it there?
mxzf
Shovel Bros
#7 - 2012-04-30 00:56:29 UTC
PyroTech03 wrote:
Ok thanks guys!

One more question then....

better to do it inside the xml parse bit (what I linked there) or do a seperate call after it's all been finished and run it there?


No reason to keep it around if you don't need it. It's kinda six of one, half-dozen of the other really, it doesn't matter a ton when you take it out, so you might as well take it out as early as you don't need it (unless it's significantly simpler to take it out later).