PHP 사용 웹 사이트 페이지를 크롤링하고 자동으로 이미지를 가져 오려고합니다. Internal Server Error
와PHP 500 내부 서버 오류 file_get_contents
<?php
$url = "http://www.domain.co.uk/news/local-news";
$str = file_get_contents($url);
?>
및
<?php
$opts = array('http'=>array('header' => "User-Agent:Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.75 Safari/537.1\r\n"));
$context = stream_context_create($opts);
$header = file_get_contents('http://www.domain.co.uk/news/local-news',false,$context);
?>
또한
<?php
include('simple_html_dom.php');
$html = file_get_html('http://www.domain.co.uk/news/local-news');
$result = $html->find('section article img', 0)->outertext;
?>
그러나이 모든 반환 :
나는 다음과 같은 시도했습니다. 나는 브라우저에서 사이트를 완벽하게 볼 수 있지만 PHP에서 페이지를 잡으려고 할 때 실패합니다.
시도할만한 것이 있습니까?
[오류보고 활성화] (http : //blog.flowl.info/2013/enable-display-php-errors/) – DanFromGermany
가능한 복제본 [PHP 파일 \ _get \ _contents 500 내부 서버 오류] /stackoverflow.com/questions/10524748/php-file-get-contents-500-internal-server-error) – majidarif