OpenSSL SSL_connect: SSL_ERROR_SYSCALL 连接到 api.amazonalexa.com:443

Opt*_*mus 6 php curl alexa

我一直在努力让技能管理 API 工作,今天早上我遇到了一个新的障碍,但没有任何改变。我收到一条“昨晚用户没有同意这个操作错误”并且今天早上没有改变任何东西,这是我得到的 curl 日志:

尝试使用与昨​​晚相同的代码访问 API,现在我得到:

string(513) "
* Hostname api.amazonalexa.com was found in DNS cache
* Trying 54.239.28.187...
* TCP_NODELAY set
* Connected to api.amazonalexa.com (54.239.28.187) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.amazonalexa.com:443
* stopped the pause stream! * Closing connection 0 "
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的代码:

ob_start();  
$out = fopen('php://output', 'w');

// exchange the access token for list of skills
$c = curl_init('https://api.amazonalexa.com/v0/skills/');
curl_setopt($c, CURLOPT_HTTPHEADER, array(
  'Authorization: ' . $access_token,
  'Accept: application/json',
  'Content-Type: application/x-www-form-urlencoded;charset=UTF-8'
));
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_VERBOSE, true);
curl_setopt($c, CURLOPT_STDERR, $out);
curl_setopt($c, CURLOPT_POST, 1);

$r = curl_exec($c);
curl_close($c);
fclose($out);
$debug = ob_get_clean();
var_dump($r);
echo "<BR><BR>";
var_dump($debug);
$d = json_decode($r);
Run Code Online (Sandbox Code Playgroud)

在这种情况下,$r 产生 bool(false) 并且 $d 输出 NULL。如果这有所作为,我将我的服务器托管在 Godaddy 上。我仍然可以通过 Amazon 访问 Login 并检索访问令牌。因此,这似乎不是托管问题。

Jun*_*san 5

根据错误跟踪,您的连接存在 SSL 错误。最明显的原因是您的托管端点没有有效的 HTTPS 证书或您的 HTTPS 配置不正确。如果您可以通过浏览器或通过curl 请求以某种方式到达端点,则可以轻松测试这一点。

  • 谢谢,但事实证明这只是 Godaddy 的一个暂时性问题,几分钟后就解决了。 (3认同)