我正在尝试设置贝宝IPN处理程序脚本,但我收到了以下错误。
$fp = fsockopen('tls://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
这条线导致以下错误-
ERROR - 2016-04-29 18:29:30 --> Severity: Warning --> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure /mypaypalipn.php 988
ERROR - 2016-04-29 18:29:30 --> Severity: Warning --> fsockopen(): Failed to enable crypto /mypaypalipn.php 988
ERROR - 2016-04-29 18:29:30 --> Severity: Warning --> fsockopen(): unable to connect to tls://www.sandbox.paypal.com:443 (Unknown error) /mypaypalipn.php 988
我试着在这里搜索stackoverflow,并了解到是SSL版本导致了这个问题,解决方案就像更改
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
至:
curl_setopt($ch, CURLOPT_SSLVERSION, 4);
但我没有使用cURL。我该怎么做才能让它与fsockopen
一起工作?
这些来自phpinfo-
注册流套接字传输
tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Apache/2.4.12
SSL Version: OpenSSL/1.0.1e
您不能像curl中那样显式地将标志设置为将SSL与fsockopen()
一起使用,您可以使用SSL包装器来查看这是否有效,
fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30)