0
내가 curl
및 preg_match
를 사용하여 하나의 웹 사이트 표를 스크랩 할Preg_match가 내부 테이블에서 작동하지 않습니까?
내 URL이 내 컬 내가 하나 개의 테이블을 폐기 할 필요가
$url = 'http://hosts-file.net/?s=Browse&f=EMD';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15"));
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body= curl_exec ($ch);
curl_close ($ch);
http://hosts-file.net/?s=Browse&f=EMD
입니다.
은 내 preg_match
기능은
preg_match_all('/<table class=\"main_normal(.*?)\">(.*?)<\/table>/s',$body,$vv,PREG_SET_ORDER);
아래에 주어진하지만 그것은 단지
있는 DOMDocument 및 DOMXPath 저에게
html을 긁어 모으려면 dom 구문을 사용하십시오. – DevZer0
제게 어떤 사례라도주세요. –
DOMDocument, DOMXPath, simple_html_dom, phpquery – DevZer0