J'essaie de gratter kickasstorrents avec simple html dom, mais je reçois une erreur et je n'ai même pas encore commencé. J'ai suivi quelques tutoriels html simples et j'ai mis en place mon URL et en utilisant curl.Essayer de gratter kickasstorrents avec simple html dom
code est le suivant:
<?php
require('inc/config.php');
include_once('inc/simple_html_dom.php');
function scrap_kat() {
// initialize curl
$html = 'http://katcr.to/new/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $html);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$ip=rand(0,255).'.'.rand(0,255).'.'.rand(0,255).'.'.rand(0,255);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/".rand(3,5).".".rand(0,3)." (Windows NT ".rand(3,5).".".rand(0,2)."; rv:2.0.1) Gecko/20100101 Firefox/".rand(3,5).".0.1");
$html2 = curl_exec($ch);
if($html2 === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
// create HTML DOM
$kat = file_get_contents($html);
}
curl_close($ch);
// scripting starts
// clean up memory
$kat->clear();
unset($kat);
// return information
return $ret;
}
$ret = scrap_kat();
echo $ret;
?>
Je reçois les erreurs
Fatal error: Call to a member function clear() on resource in C:\wamp64\www\index.php on line 36
Que dois-je faire le mal? Merci.
Je peux confirmer que self-html-dom s'étouffe sur cette page. Vous pouvez [essayer ceci en remplacement] (https://github.com/monkeysuffrage/advanced_html_dom). – pguardiario