dsbfbz75185 2012-05-03 11:56
浏览 91
已采纳

Paypal - 新服务器中的CURL响应为0(连接超时),在旧服务器中没问题

I'm trying to connect to Paypal Sandbox from a new server. If I test the code in my local computer (using XAMPP) it works fine. Also, if I test the code in my old server, it works ok too (same PHP version and libraries, and the new server should have the same configuration as the old (although I'm starting to doubt it...).

I redirect the CURL output to a file and this is what I get (similar output in curl_error()):

About to connect() to svcs.sandbox.paypal.com port 443 (#0)
Trying 173.0.82.89... * Connection timed out
couldn't connect to host
Closing connection #0

This is the output of curl_getinfo():

[url] => https://svcs.sandbox.paypal.com/AdaptivePayments/Pay?actionType=PAY...
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0.058702
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0
[redirect_time] => 0

This is the PHP code:

$ch = curl_init();    
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER
    , array(
    'X-PAYPAL-SECURITY-USERID: '.$api_userid
    , 'X-PAYPAL-SECURITY-PASSWORD: '.$api_pass
    , 'X-PAYPAL-SECURITY-SIGNATURE: '.$api_signature
    , 'X-PAYPAL-APPLICATION-ID: '.$api_appid
    , 'X-PAYPAL-REQUEST-DATA-FORMAT: NV'
    , 'X-PAYPAL-RESPONSE-DATA-FORMAT: NV'
    )    
);

$response = curl_exec($ch);

I think the problem points to a server configuration issue, but I'm a little lost in wich way I have to look: PHP configuration, Apache, firewall, ... ¿any ideas?

  • 写回答

2条回答 默认 最新

  • doujiao3016 2012-05-03 21:05
    关注

    OK. It was a SSL configuration problem. The outgoing SSL port (443) was closed so the server couldn't establish a connection with Paypal.

    Thanks for your ideas :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退