...

View Full Version : not to execute cUrl everytime



ataomega
10-30-2012, 03:49 AM
Hello all.

see code first :

if ( $payment ) {
$merchantID = $data[merchantID];
$amount = $data[amount];
$invoice_id = $data[invoice_id];
$callbackUrl = $data[callback];
$email = $payment[payment_email];
///////////////\\\\\\\\\\\\\\\\
$url = 'http://www.mehrpay.ir/direct.php';
$fields = array(
'resnum'=>urlencode("$invoice_id"),
'email'=>urlencode("$email"),
'amount'=>urlencode("$amount"),
'id'=>urlencode("$merchantID"),
'callback'=>urlencode("$callbackUrl"),
);
$fields_string = "";
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$au = curl_exec($ch);
curl_close($ch);
///////////////\\\\\\\\\\\\\\\\
$update[payment_rand] = $au;
$sql = $db->queryUpdate('payment', $update, 'WHERE `payment_rand` = "'.$order_id.'" LIMIT 1;');
$db->execute($sql);
header('location:https://www.pec24.com/pecpaymentgateway/?au='.$au);
exit;
}

when i call $au here :

$update[payment_rand] = $au;

and when again calling it here :

header('location:https://www.pec24.com/pecpaymentgateway/?au='.$au);

everytime cUrl executes again and everytime a new amount. and this is my problem

i need result of executing cUrl first time, not to execute it everytime

any solution please?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum