<?php
session_start();
//create array of data to be posted
//traverse array and prepare data for posting (key1=value1)
//set POST variables
$url = 'xxx/cart2.php';
$fields = array(
'ssl_merchant_id' => ('xxx'),
'ssl_user_id' => ('xxx'),
'ssl_pin' => ('xxx'),
'ssl_transaction_type' => ('xxx'),
'confirm_code' => ($_POST['confirm_code']),
'ssl_show_form' => ('xxx'),
'ssl_cardholder_ip' => ($_POST['ssl_cardholder_ip']),
'ssl_amount' => ($_POST['ssl_amount'])
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init('xxx/cart2.php');
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
echo $result;
?>
每到這個代碼加載,它是創建一個新的會話!我如何去防止每次加載新會話?這只是我自己找到並修改的腳本,因爲我以前從未使用過cURL。捲曲會話問題
你是什麼意思它開始一個新的會話? –
您是否啓用了cookies? – Antony