PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
aodat2
Forum Newbie
Posts: 12 Joined: Wed Aug 13, 2008 7:19 am
Post
by aodat2 » Wed Aug 13, 2008 12:58 pm
The domain doesn't really make a BIG difference but then again if you really wanna see the whole thing, then it's here...
I have already basically posted everything but if you think there's more, then be my guest
Code: Select all
<?PHP
function Requery(){
$query = "http://www.mobile88.com/epayment/enquiry.asp?MerchantCode=" .
$MerchantCode . "&RefNo=" . $RefNo . "&Amount=" . $Amount;
$url = parse_url($query);
$host = $url["host"];
$path = $url["path"] . "?" . $url["query"];
$timeout = 1;
$fp = fsockopen ($host, 80, $errno, $errstr, $timeout);
if ($fp) {
fputs ($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n");
while (!feof($fp)) {
$buf .= fgets($fp, 128);
}
$lines = split("\n", $buf);
$Result = $lines[count($lines)-1];
fclose($fp);
} else {
# enter error handing code here
}
return $Result;
}
?>
desmi
Forum Commoner
Posts: 64 Joined: Sun Jun 15, 2008 4:55 am
Post
by desmi » Wed Aug 13, 2008 1:11 pm
Yea, mainly i wanted it to test that code by myself..
And what i found out is, your .asp page returns that 'invalid parameters'. Still working on it to get it work
Just a sec
desmi
Forum Commoner
Posts: 64 Joined: Sun Jun 15, 2008 4:55 am
Post
by desmi » Wed Aug 13, 2008 1:16 pm
Ok, there..
Code: Select all
function Requery($MerchantCode, $RefNo, $Amount)
{
$query = "http://www.mobile88.com/epayment/enquiry.asp?MerchantCode=" . $MerchantCode .
"&RefNo=" . $RefNo . "&Amount=" . $Amount;
$url = parse_url($query);
$host = $url["host"];
$path = $url["path"] . "?" . $url["query"];
$timeout = 30;
$fp = fsockopen($host, 80, $errno, $errstr, $timeout);
if ($fp) {
fputs($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n");
while (!feof($fp)) {
$buf .= fgets($fp, 128);
}
$lines = split("\n", $buf);
$Result = $lines[count($lines) -1];
fclose($fp);
} else {
# enter error handing code here
}
return $Result;
}
$verify = Requery(1234, 22, 1.00);
echo $verify;
This works, your function couldnt load any values to those variables (code, nro and amount) and now it does, if you dont understand how, ask me
aodat2
Forum Newbie
Posts: 12 Joined: Wed Aug 13, 2008 7:19 am
Post
by aodat2 » Wed Aug 13, 2008 1:34 pm
Thanks for all the help. I guess it's working now.
Have a wonderful day.