ホーム
  • 支払いと送金
  • 異議と制限
  • マイアカウント
  • マイウォレット
  • ログインとセキュリティ
  • 売り手向けツール

How do I modify my IPN PHP listener to support HTTP1.1?

Important: PayPal has required the use of HTTP 1.1 since October 2013.

To modify your IPN PHP listener to support HTTP1.1, you need to include the "Host" and "Connection" headers in the IPN postback script. The following example shows how: PHP
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.paypal.com\r\n";
$header .= "Connection: close\r\n\r\n";
Note: For further compatibility, your PHP script should also trim the IPN validation response. Modify your script from this:
 
if (strcmp ($res, "VERIFIED") == 0) {
..
else if (strcmp ($res, "INVALID") == 0) {
To this:
 
if (strcmp (trim($res), "VERIFIED") == 0) {
..
else if (strcmp (trim($res), "INVALID") == 0) {
In PHP, check that the last line of your header includes double end-of-line markers: \r\n\r\n as in the next example:
 
$header .="Connection: close\r\n\r\n";
In PHP, open the socket connection to the same host declared in the header. Your header is declaring the host as:
 
$header .="Host: www.paypal.com\r\n";
You should open the connection to the same host:
 
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

Note: For new IPN integrations, we recommend these updated samples.
この記事は役に立ちましたか?

その他のサポートに関する情報

お気づきの点はございませんか?
アンケートに答える

引き続き閲覧する場合は、Cookieを使用して、お客さまのエクスペリエンスを向上させ、カスタマイズします。パーソナライズされた広告を表示するためにCookieを使用してもよろしいですか? 詳細を確認して、お客さまの Cookieを管理する