当前位置:Gxlcms > PHP教程 > phpcurl请求https

phpcurl请求https

时间:2021-07-01 10:21:17 帮助过:2人阅读

这篇文章介绍的内容是关于php curl 请求https ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

function curl_get_https($url){    $curl = curl_init(); // 启动一个CURL会话
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);  // 从证书中检查SSL加密算法是否存在
    $tmpInfo = curl_exec($curl);     //返回api的json对象
    //关闭URL请求
    curl_close($curl);    return $tmpInfo;    //返回json对象}

相关推荐:

php curl请求接口并获取数据

以上就是php curl 请求https的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行