我一直在尝试从我在服务器上创建的PHP页面访问这个特定的REST服务.我将问题缩小到这两行.所以我的PHP页面如下所示:
<?PHP
$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");
echo $response; ?>
解决方法:
http://php.net/manual/en/migration56.openssl.php
一篇官方文档,描述了在PHP 5.6中打开ssl所做的更改
从这里我学到了另一个我应该设置为false的参数:“verify_peer_name”=> false
Note: This has very significant security implications. disabling verification potentially permits a 07001 to use an invalid certificate to eavesdrop on the requests. While it may be useful to do this in local development, other approaches should be used in production.
所以我的工作代码如下所示:
<?PHP
$arrContextOptions=array(
"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; ?>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。