// 일부 변경을했지만 preg_match 함수가 작동하지 않고 작동합니다. 나는 틀린 것을 이해할 수 없다. 나는 갈거야 미친PHP는 작동하지만 preg_match가 작동하지 않습니다.
public function crawl()
{
$html = $this->getPageHTMLContent($this->getDomain().$this->entryPagePath);
$categoryPageDom = $this->getHtmlDom($html);
echo $categoryPageDom->find('div#pagination a.gh', 1)->attr['href'];
preg_match("/\?p=(.*)&q/", $categoryPageDom->find('div#pagination a.gh', 1)->attr['href'], $machtes);
var_dump($machtes);
}
public function getPageHTMLContent($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);
return $contents;
}
이 줄을 제거하십시오. curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true); – GBD