개인 프로젝트를 만들려고 노력하고 있습니다. 그러나 Simple HTML DOM 클래스를 사용할 때는 약간의 어려움이 있습니다.PHP 간단한 HTML DOM 긁힌 외부 URL
내가하고 싶은 것은 웹 사이트를 긁어내어 모든 콘텐츠를 검색하고 내부 HTML로 특정 클래스와 일치시키는 것입니다.
내 코드는 지금까지 있습니다 :
<?php
error_reporting(E_ALL);
include_once("simple_html_dom.php");
//use curl to get html content
$url = 'http://www.peopleperhour.com/freelance-seo-jobs';
$html = file_get_html($url);
//Get all data inside the <div class="item-list">
foreach($html->find('div[class=item-list]') as $div) {
//get all div's inside "item-list"
foreach($div->find('div') as $d) {
//get the inner HTML
$data = $d->outertext;
}
}
print_r($data)
echo "END";
?>
나는이 함께 얻을 모든 "END"아무것도 모든 출력에 빈 페이지입니다.
[웹 페이지 내용 고르기] (http://stackoverflow.com/questions/584826/scrape-web-page-contents) –