Home > PHP Solutions > Checking E-gold Balance with PHP and cURL

Checking E-gold Balance with PHP and cURL

I’ve been using e-gold for a while and I am very pleased with this online payment system. Especially I like their shopping card interface that allows to accept or make payments instantly. Today I’ll show you how to check e-gold balance having automation activated and server IP added. This code was written several years ago, so forget me some irregular methods :)

$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.e-gold.com/acct/balance.asp?AccountID=E-gold&Passphrase=Password");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
$content=curl_exec($ch);
curl_close($ch);

if($content)
{
$balancecontent=$content;
$ot1=strpos($balancecontent, 'type=hidden name=Gold_Grams');
$balancecontent=substr($balancecontent, $ot1);
$ot=strpos($balancecontent," “)+67;
$rezcont=substr($balancecontent, $ot);
$do=strpos($rezcont, “

“);
$balance=substr($balancecontent, $ot, $do);
echo $balance;
}
?>

This code will output your e-gold account balance. If not, please,check whether everything is ok with automation access (you have to confirm several times that you want to enable automation at their site).

  1. No comments yet.
  1. No trackbacks yet.