데이터를 내부 div에 저장하는 웹 사이트에서 모든 이미지를 가져오고 싶습니다. 어떻게 모든 이미지를 가져올 수 있습니까? 노력했지만 작동하지 않습니다. 다음은 [각도] 자바 스크립트에 의해 작동하는 웹 사이트를 스크랩 할 수없는 내 코드웹 스크 레이 핑으로 웹 사이트에서 데이터 가져 오기
<?php
$html = file_get_contents('http://en.vonvon.me/'); //get the html returned from the following url
$pokemon_doc = new DOMDocument();
libxml_use_internal_errors(TRUE); //disable libxml errors
if(!empty($html)){ //if any html is actually returned
$pokemon_doc->loadHTML($html);
libxml_clear_errors(); //remove errors for yucky html
$pokemon_xpath = new DOMXPath($pokemon_doc);
//get all the h2's with an id
$pokemon_row = $pokemon_xpath->query('div[class=desc ng-binding]');
if($pokemon_row->length > 0){
foreach($pokemon_row as $row){
echo $row->nodeValue . "<br/>";
}
}
}
?>
입니다 사용할 수 있습니까? 아니오 또는 잘못된 출력? 오류 메시지? 오류 로그를 확인 했습니까? Btw .. 만약 당신의 코드가 작동하지 않는다면 디버깅 할 때 도움이되는 에러 메시지를 표시하지 않기 때문에'@ '기호를 제거해야합니다. –