我一直在研究如何在沒有用戶點擊結帳按鈕的情況下自動傳遞PayPal表單提交。下面是代碼我有那麼這樣做:嘗試使用cURL提交Paypal表單...
<?php
$post_data['cmd'] = '_xclick';
$post_data['business'] = '[email protected]';
$post_data['item_name'] = 'The Items You are Purchasing';
$post_data['amount'] = '25';
$post_data['no_shipping'] = '1';
$post_data['no_note'] = '1';
$post_data['currency_code'] = 'USD';
$post_data['bn'] = 'PP-BuyNowBF';
foreach ($post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}
$post_string = implode ('&', $post_items);
$curl_connection = curl_init('https://www.paypal.com/cgi-bin/webscr');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($curl_connection);
curl_close($curl_connection);
?>
是最好的,我可以告訴大家這個應該交給貝寶傳遞價值,並要求用戶支付$ 25「的項目是購買」到「myemail @ website.com「。但由於某種原因,它不起作用,你知道爲什麼嗎?
我瞭解客戶必須登錄paypal並輸入付款和賬單信息。我只是需要這樣做,讓用戶訪問paypal頁面,併爲用戶設置信息。我將研究使用GET參數,看看是否可行。感謝你的回答。 – Presto
我很猶豫,但不管怎樣,我的英語怎麼樣?它是否令人滿意?不要猶豫與評論:) –
是的,你的英語是令人滿意的。保持良好的工作:) – Presto