簡體   English   中英

PayPal沙箱IPN不再響應

[英]PayPal sandbox IPN not responding anymore

我正在使用Paypal沙箱測試我的PHP腳本,該腳本可用於www.paypal.com但不能與www.sandbox.paypal.com 我最近從PayPal收到一封電子郵件,要求使用HTTP 1.1協議而不是1.0,所以我做到了,而且我正在使用Connection: close按指定的標題Connection: close ,但IPN URL掛起。 當我在www.paypal.com上嘗試時,沒有懸掛。

貝寶在第二封電子郵件中對此做了具體說明

這是我們在2012年9月6日發送的公告的后續措施。引起我們注意的是,一些商家遇到了使其IPN腳本更新為使用HTTP 1.1的問題,因為這些腳本會“掛”或花費很長時間。是時候獲得“驗證”答復了。 我們包括有關如何通過在HTTP請求中添加“ Connection:close”標頭來解決此問題的說明。

但是很顯然那是行不通的。

$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Host: $url\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$header .= "Connection: close\r\n";

有任何想法嗎? 幫助非常感謝。

您在倒數第二行有\\ r \\ n \\ r \\ n,它需要在最后一行...

$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Host: $url\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Host: www.paypal.com\r\n"; 
$header .= "Connection: close\r\n\r\n";

您還需要主機行。

我不知道它為什么掛起的答案,但是使用curl而不是fsockopen似乎可以解決我的問題。 我在這里使用了解決方案;

https://www.x.com/developers/PayPal/documentation-tools/code-sample/216623

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM