Ai
0 Star 0 Fork 0

kkcode/note

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.php 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
kkcode 提交于 2023-05-18 04:32 +08:00 . 测试PHP curl相关函数
<?php
// create curl resource
$ch = curl_init();
// set url
// https://www.hdmoli.com/mlist/index1-1.html 此站点的ssl证书版本较高
// 参考:https://www.cnblogs.com/diannao-run/p/13060298.html
// 也许这是解决办法:https://www.lyecs.com/article.html?aid=281 升级到最高版本的openssl
// 或者升级PHP扩展curl
// guzzleHttp https://www.cnblogs.com/yehuisir/p/11114807.html 设置verify为false
curl_setopt($ch, CURLOPT_URL, "https://blog.csdn.net/my_study_everyday/article/details/130685783");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// https 关闭SSL认证
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
// 指定使用TLSv1.2;数字 6 是 TLSv1.2 的 CURL_SSLVERSION_TLSv1_2 常量的值
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
// $output contains the output string
$output = curl_exec($ch);
$info = curl_getinfo($ch);
//echo output
file_put_contents('./index.html', $output);
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
// close curl resource to free up system resources
curl_close($ch);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qqcode/note.git
git@gitee.com:qqcode/note.git
qqcode
note
note
master

搜索帮助