This is my php code to get the balance of an e-gold account.
Insead of returning the balance I get the e-gold login form.
Any help on figuring out why is greatly appreciated.
$acct="123456";
$pass="sample1";
$amount=0;
//open a connection
$url = "ssl://e-gold.com";
$fp = fsockopen($url,443,$errno,$errstr,30);
if(!$fp) {
echo "$errno-$errstr<br>";
}
//setup parameters to pass to e-gold
$request="?AccountId=".urlencode($acct)."&PassPhrase=".urlencode($pass);
//pass parameters to e-gold service
fputs($fp, "GET /acct/balance.asp HTTP/1.0\r\n");
fputs($fp, "Host: www.e-gold.com\r\n");
fputs($fp, "Content-Type: application/x-www-url-encoded\r\n");
fputs($fp, "Content-Length: ".strlen($request)."\r\n");
fputs($fp, "Accept: /\r\n");
fputs($fp, "\r\n");
fputs($fp, $request."\r\n");
fputs($fp, "\r\n");
//make the post request and accept the return values
$output = "";
while(!feof($fp)) {
$output .= fgets($fp,1024);
}
//close the connection
fclose($fp);