duankui1532 2015-05-03 04:55
浏览 35

paypal ipn不能在我的网站上工作(https)

I use paypal.class.php at my site

after long search I found problem at this code and I think Https id the reason for that I use paypal simulator IPN and give me We could not send an IPN due to an HTTP error.

function validate_ipn() 
   {
      // parse the paypal URL
      $url_parsed=parse_url($this->paypal_url);  
      // generate the post string from the _POST vars as well as load the
      // _POST vars into an array so we can play with them from the calling
      // script.
      $post_string = '';    
      foreach ($_POST as $field=>$value) 
      { 
         $this->ipn_data["$field"] = $value;
         $post_string .= $field.'='.urlencode(stripslashes($value)).'&'; 
      }
      $post_string.="cmd=_notify-validate"; // append ipn command
      // open the connection to paypal
       $fp = fsockopen('ssl://www.sandbox.paypal.com', "443", $err_num, $err_str, 30);
      if(!$fp) 
      {
         // could not open the connection.  If log in is on, the error message
         // will be in the log.
         $this->last_error = "fsockopen error no. $errnum: $errstr";
         $this->log_ipn_results(false);       
         return false;   
      } 
      else 
      { 
         // Post the data back to paypal
         fputs($fp, "POST $url_parsed[path] HTTP/1.1
"); 
         fputs($fp, "Host: $url_parsed[host]
"); 
         fputs($fp, "Content-type: application/x-www-form-urlencoded
"); 
         fputs($fp, "Content-length: ".strlen($post_string)."
"); 
         fputs($fp, "Connection: close

"); 
         fputs($fp, $post_string . "

"); 
         // loop through the response from the server and append to variable
         while(!feof($fp)) 
         { 
            $this->ipn_response .= fgets($fp, 1024); 
         } 
         fclose($fp); // close connection
      }
      if (eregi("VERIFIED",$this->ipn_response)) 
      {
         // Valid IPN transaction.
         $this->log_ipn_results(true);
         return true;       
      } 
      else 
      {
         // Invalid IPN transaction.  Check the log for details.
         $this->last_error = 'IPN Validation Failed.';
         $this->log_ipn_results(false);   
         return false;
      }
   }

only log out put

[05/02/2015 11:51 PM] - FAIL: IPN Validation Failed.
IPN POST Vars from Paypal:

IPN Response from Paypal Server:
 HTTP/1.1 200 OK
Date: Sun, 03 May 2015 03:51:12 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=osM32uUn-vC254nQtV1__tIqPp-KarXAs_dXFLYfS9a-SaS9WMeupawFgNJMu2PgyCBqKWyI6_V2QmVXDFAEXCsqzao7fSg5kGy_hpXhWCTWIoTT6Uv30YRKFU8eUOyNnx86JwdTVukR3J3KjenUMAeI9TDy-49Fy1bLTYmi7wZI7gU5LqAKTHh4tBCtkL7EchOhWAEMFgT5WZLvxr_aR4wuCXOUngzE2iTwO4I4KKSpTqtt5jsCNItkVuLtoGvLeBF6hW5aS_4LPjLbfP6DyXu9W95KcRteWTptjySCY0geZnjXZaC0RIqUsRVpP58jo7GjiFJiAsR2AY8S3lO-gwZKjy1EvBJstzI_7gvdUrla5xyAhuKSY9fLc1B1qa7bNEVGG9R01XoTtPWQRxGN8EJhWFNPIyr6JoK11Edfj66PUUlEZXvTwCDQX7m; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: cookie_check=yes; expires=Wed, 30-Apr-2025 03:51:13 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navlns=0.0; expires=Tue, 02-May-2017 03:51:13 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: Apache=10.72.108.11.1430625072976307; path=/; expires=Tue, 25-Apr-45 03:51:12 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D880%26app%3Dappdispatcher%26TIME%3D815482197; 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.1430625072960092; path=/; expires=Tue, 25-Apr-45 03:51:12 GMT
Strict-Transport-Security: max-age=14400
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

7
INVALID
0

my site https can any one help me

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法