file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL(示例

Posted 加菲猫and大白

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL(示例相关的知识,希望对你有一定的参考价值。

原代码:

<?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; ?>
报错 file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL ...

修改后
<?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; ?>

帮助文档:http://php.net/manual/en/migration56.openssl.php

以上是关于file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL(示例的主要内容,如果未能解决你的问题,请参考以下文章