lundi 17 septembre 2018

How to web scrape with php and [duplicate]

i am trying to web scrape this site and get to connect it but my server return this error

(ip )is currently unable to handle this request. HTTP ERROR 500

my code is;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://suumo.jp/chintai/osaka/ek_05680/");
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$html  = curl_exec($ch);
curl_close($ch);

$DOM new DOMDocument;
libxml_use_internal_errors(true);
$DOM->loadHTML($html);

$elements = $DOM->getElementByTagClass("cassette-price-accent");

echo $elements->item($i)->nodeValue."<br>";

Do I something wrong?

thanks for helps




Aucun commentaire:

Enregistrer un commentaire