<?php
$content = [ 'http' => [ 'method' => 'GET' ], 'ssl' => [ 'verify_peer' => false, 'allow_self_signed'=> true ] ];
$url = 'http://localhost/server-status';
$content = file_get_contents($url);
$first_step = explode('Current' , $content);
$second_step = explode("</dl>" , $first_step[1]);
echo $second_step[0];
?>
내 PHP가 admin 패널의 서버 상태에서 통계를 얻을 수 있도록 localhost가 항상 https로 간다. 즉, SSL이 활성화되어 PHP가 내용을 가져올 수 없다는 것을 의미한다. localhost에서는 유효하지 않습니다.localhost에서 자체 서명 된 PHP를 허용 하시겠습니까? (SSL을 사용 안함?)
file_get_contents를 수행 할 때 어떻게 비활성화합니까?
왜 서버가 인증서를 신뢰하지 않습니까? https://unix.stackexchange.com/questions/90450/adding-a-self-signed-certificate-to-the-rusted-list – ceejayoz
첫 번째 줄은'$ content' 대신'$ context'라고되어 있습니까? 당신은 또한'file_get_contents' 호출에 그것을 전달하지 않을 것입니다. 또는 자동으로 적용되는 컨텍스트로'stream_context_set_default'를 호출 할 수도 있습니다. – iainn
@iainn 어떻게하면 좋을까요? 내가 잘못 나온 곳을 찾아내는 데 도움이 될만한 답변을 게시 할 수 있습니까? – rakupu