有人可以請向我解釋爲什麼這會一直返回一個HTTP 302響應代碼?PayPal IPN沙箱返回HTTP 302
我已經運行了數十次測試付款,而且我現在開始拉我的頭髮了!
編輯 ...那第二行應該是:
$data = 'cmd=_notify-validate&' . http_build_query($_POST);
$conn = fsockopen("ssl://www.sandbox.paypal.com", 443, $n, $m, 30);
$data = http_build_query($_POST);
$headers =
"POST /cgi-bin/webscr HTTP/1.0\r\n" .
"Host: www.sandbox.paypal.com\r\n" .
"Content-Type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($data) . "\r\n";
fputs($conn, "$headers\r\n$data");
// loop until end of response
while (!feof($conn)) {
$r = fgets($conn, 1024);
$results .= $r;
if (strcmp($r, "VERIFIED") === 0) {
$success = true;
fclose($conn);
break;
}
if (strcmp($r, "INVALID") === 0) {
$success = false;
fclose($conn);
break;
}
}
var_dump($results);
給我:
HTTP/1.1 302 Found
Date: Sun, 05 Apr 2015 01:05:19 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=jpXL4slHSFMW62IfhXt98Ecs62rNGxGaMe9do0PXFTJCvKNoSWrzcNKb58XDiADlB6Vd4sSqrQt-mdqdmwlhYjnS-vrmseHmpUXfgJB02GXawXmw-0ORrjpAlcs9MjNzjerB9260RGRm1oASkzbL6fKubJohZlpTuM9ejW-hubbqKhagUSvvO7jyvT-6qewxY72pyDVtulr0FV3X3b5N8HwihlK2nzr9LK6NbwwmrzH3gOsHz7GQ4Mt7M8y; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: -1ILhdyICORs4hS4xTUr41S8iP0=uyJXnbFu20vqgtvwa1990vbI5M5aG7JM-hGvulSB7_Mg0vU_l6yRwHrZj3FFHc1v8V_6jaqEahhmS6Wt; expires=Sat, 31-Mar-2035 01:05:19 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: cookie_check=yes; expires=Wed, 02-Apr-2025 01:05:19 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: consumer_display=USER_HOMEPAGE%3d0%26USER_TARGETPAGE%3d0%26USER_FILTER_CHOICE%3d0%26BALANCE_MODULE_STATE%3d1%26GIFT_BALANCE_MODULE_STATE%3d1%26LAST_SELECTED_ALIAS_ID%3d0%26SELLING_GROUP%3d1%26PAYMENT_AND_RISK_GROUP%3d1%26SHIPPING_GROUP%3d1%26HOME_VERSION%3d1%26MCE2_ELIGIBILITY%3d4294967295; expires=Wed, 02-Apr-2025 01:05:19 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: Apache=10.72.108.11.1428195919710342; path=/; expires=Tue, 28-Mar-45 01:05:19 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D880%26app%3Dappdispatcher%26TIME%3D1334452309; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
Set-Cookie: Apache=10.72.128.11.1428195919696329; path=/; expires=Tue, 28-Mar-45 01:05:19 GMT
Location: https://www.sandbox.paypal.com/home
Strict-Transport-Security: max-age=14400
Content-Type: text/html; charset=ISO-8859-1
通知我上午使用ssl://
和端口443
儘管此鏈接可能會回答問題,但最好在此處包含答案的重要部分,並提供供參考的鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 – Khalid 2015-04-05 08:36:21
@哈立德這不是一個答案的鏈接。這甚至不是一個鏈接。這是API端點。 – Machavity 2015-04-06 12:11:43
有趣的是,我發現的所有東西都表示它指向'ssl://'。使用https://也會觸發服務器錯誤,可能是由於配置錯誤。 – 2015-04-06 12:12:03