I want to get html code and find from a website ,I'm using this code to do so but I'm getting error
"The simultaneous use of the curl and htmldomparser"
Fatal error: Call to a member function find() on string in C:\cod.php on line 46
Line ERROR:
foreach ($content->find('div[class=postbody]') as $element)
I was able to get the full source using the login But the problem is :
foreach ($content->find('div[class=postbody]') as $element)
this cod:
include_once('/simple_html_dom.php');
error_reporting(E_ALL);
function vBulletinLogin($username,$password,$url,$posturl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER,false);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'veri.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'veri.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_COOKIESESSION,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $url.'index.php');
curl_setopt($ch, CURLOPT_URL, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "vb_login_username=$username&vb_login_password&s=&securitytoken=guest&do=login&vb_login_md5password=".md5($password)."&vb_login_md5password_utf=".md5($password));
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_URL, $url.'clientscript/vbulletin_global.js?v=373');
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_REFERER, $url.'login.php?do=login');
curl_setopt($ch, CURLOPT_URL, $url.'index.php');
$exec = curl_exec($ch);
curl_setopt($ch, CURLOPT_REFERER, $url.'index.php');
curl_setopt($ch, CURLOPT_URL, $posturl);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
$content = vBulletinLogin('user','pass','url','url');
foreach ($content->find('div[class=postbody]') as $element)
{
echo $element;
}
Aucun commentaire:
Enregistrer un commentaire