在使用例如file_get_contents这样的函数读取https的资源的时候,遇到这个报错信息
首先确认加载了openssl模块 并且allow_url_fopen是打开状态
这种时候有两种方案
简单粗暴的跳过ssl认证
array( "verify_peer"=>false, "verify_peer_name"=>false, ), ); $response = file_get_contents("https://maps.co.weber.ut.us/arcgis/rest/services/SDE_composite_locator/GeocodeServer/findAddressCandidates?Street=&SingleLine=3042 N 1050 W&outFields=*&outSR=102100&searchExtent=&f=json", false, stream_context_create($arrContextOptions)); echo $response; ?>
第一种方法属于比较粗暴的方法 直接放弃ssl认证,不建议这种方法。
1.前往ca证书下载地址下载下来证书
2.上传至服务器的php的可读目录
3.配置php.ini 中的openssl.cafile
[openssl]openssl.cafile=/***php可读目录***/cert.pem
4.重启php-fpm就可以了。
免费试用尝鲜
贴心会员服务
服务可用性
数据安全保障
全年不间断在线
工作时间:早上9:00-下午6:30
河南快米云网络科技有限公司
公安备案编号:41010302002363
Copyright © 2010-2023 All Rights Reserved. 地址:河南自由贸易区开封片区经济开发区宋城路122号