Page 2 of 2

Re: PHP Help Needed - Noobie

Posted: Wed Aug 13, 2008 12:58 pm
by aodat2
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;
}
?>

Re: PHP Help Needed - Noobie

Posted: Wed Aug 13, 2008 1:11 pm
by desmi
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

Re: PHP Help Needed - Noobie

Posted: Wed Aug 13, 2008 1:16 pm
by desmi
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 :)

Re: PHP Help Needed - Noobie

Posted: Wed Aug 13, 2008 1:34 pm
by aodat2
Thanks for all the help. I guess it's working now.

Have a wonderful day.