Главная > PHP > file_get_contents(): SSL operation failed with code 1

file_get_contents(): SSL operation failed with code 1

При:

$cities_get=file_get_contents(LOS_URL.'ajax.php?type=cities');

Ошибка:

<br />
<b>Warning</b>:  file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in <b>/var/www/site.ru/index.php</b> on line <b>241</b><br />
<br />
<b>Warning</b>:  file_get_contents(): Failed to enable crypto in <b>/var/www/site.ru/index.php</b> on line <b>241</b><br />
<br />
<b>Warning</b>:  file_get_contents(https://site.su/ajax.php?type=cities): failed to open stream: operation failed in <b>/var/www/site.ru/index.php</b> on line <b>241</b><br />

Решение:

$arrContextOptions=array(
	"ssl"=>array(
		"verify_peer"=>false,
		"verify_peer_name"=>false,
	),
);
$cities_get=file_get_contents(LOS_URL.'ajax.php?type=cities',false,stream_context_create($arrContextOptions));
Categories: PHP Tags:
  1. Пока что нет комментариев.
Похожие публикации