我正试图从api电话获得回复,
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://fm.transfer-to.com/cgi-bin/shop/topup');
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$response = curl_exec($curl);
echo $response;
$status = curl_getinfo($curl);
curl_close($curl);
//上面的代码没有输出
我尝试了file_get_contents()
,但是
$url ="https://fm.transfer-to.com/cgi-bin/shop/topup";
$responses = split("\n", file_get_contents($url));
foreach ($responses as $response) {
$key = split("=", $response)[0];
$value= split("=", $response)[1];
if($key != "" && $value != "") {
$data[$key] = $value;
}
}
失败:failed to open stream: Connection timed out.
如何从Api获取响应(API发回纯文本,而不是json),当我使用表单请求上述URL时。
答案 0 :(得分:1)
https上的这个服务器有only TLSv1 support and very limited and weak ciphers support only,我相信你的PHP库没有协商这个配置
解决此问题
见