Ideosphere Forum

Re: fx-devel: PHP stuff

Author: Tom
Conversation: fx-devel: PHP stuff ( prev | next ) reply!
Topic: fx-devel ( prev | next )
In-Reply-To: Ken Kittlitz's post
Date: Tue Oct 11, 2005 12:22 pm
Ken Kittlitz

Message from Ken Kittlitz, received on 11. Oct 2005 at 19:04:
> >Should I put this stuff into a seperate class or just use standalone
> >functions?
> I'd be tempted to do whatever's the least work for now ;-). We can always
> decide to factor later if that makes sense.

Ok, then I'll just do standalone functions. I'm not much into OO.

Here's the function, btw. in case anyone cares. It's pretty crude. I'm
thinking about creating a more general version but I don't yet know
enough about the fxtp commands to write a general parser function for

function get_claimlist() {
global $con, $status;


if (!$con->send("claim_info .*,status,pairs,short,price")) {
$status = $con->status();
return false;
} else {
$raw = $con->response();
$row=0; $col=0;
foreach ($raw as $data) {
switch ($col) {
case 0: $line=array();
case 1: $line['status']=$data; break;
case 2: $line['pairs']=$data; break;
case 3: $line['short']=$data; break;
case 4: $prices = explode("\t",$data);
$row++; $col=-1; /* start next line */

return $claimlist;

The result is then very easy to use in PHP, like this:

$claimlist = get_claimlist();
foreach ($claimlist as $claim) {
// something... data is now in $claim['short'], $claim['ask'], etc.

pub 1024D/2D7A04F5 2002-05-16 Tom Vogt <>
Key fingerprint = C731 64D1 4BCF 4C20 48A4 29B2 BF01 9FA1 2D7A 04F5


All trademarks, copyrights, and messages on this page are owned by their respective owners.
Forum: Copyright (c) 2000-2001 Javien Inc All rights reserved. Distributed under the GPL