내가 이런 PHP 스크립트가 : 때때로 일어나는 무엇curl, file_get_contents를 사용하는 방법?
<?php
$likes = 'https://graph.facebook.com/google';
$fb = file_get_contents($likes);
$fb_array=json_decode($fb,true);
$all_likes = $fb_array['likes'];
$english_format = number_format($all_likes);
?>
URL은 실패와 나는 이런 식으로 뭔가를 얻을 :
Warning: file_get_contents(https://graph.facebook.com/google) [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/html/google/index.php on line 774
위한 방법이 있는지 궁금 해서요 코드가 정상적으로 작동하지 않는 이유는 전체 웹 사이트를 다운시키고 있기 때문입니다.
PHP 또는 컬 대안이 오류를 처리하는 경우 나는 생각했다.
어떤 아이디어가 있습니까?
감사
편집 : 나는 그래서이 수 :
<?php
$likes = 'https://graph.facebook.com/google';
if([email protected]_get_contents($likes)){
$english_format = 123;
} else {
$fb = file_get_contents($likes);
$fb_array=json_decode($fb,true);
$all_likes = $fb_array['likes'];
$english_format = number_format($all_likes);
}
?>
하지만 여전히 내 웹 사이트
오류 방지 기능을 사용하는 이유는 무엇입니까? – NullUserException