Ben özel bir forum bazı veri ayıklamak çalışıyorum. Ben sayfa veri ayıklamak için bir PHP oturum CURL kullanır Senaryo, ve DOMDocument yarattı.
Ben başarılı bir komut ile oturum açtıysanız, ama en kısa sürede ben loadHTMLFile kullanarak bir web sayfası () yüklemeye çalışırken daha önce hiç girmedi sanki davranır.
Birisi çerez başlık göndermek gerekebilir söyledi? Ama bu bile gerekli olduğunu ya da olmadığını nasıl hiçbir fikrim yok.
Herkes herhangi bir fikir var mı?
<?
function vBulletinLogin($user, $pass)
{
$md5Pass = md5($pass);
$data = "do=login&url=index.php&vb_login_md5password=$md5Pass&vb_login_username=$user&cookieuser=1";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "****"); // replace ** with tt
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_TIMEOUT, '10');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/public_html/phpcrawl/cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/public_html/phpcrawl/cookies.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERRER, "****");
$store = curl_exec ($ch);
echo $store; <- **this shows that I have successully logged in, it gives me a welcome message**
print_r($_COOKIE);
curl_close($ch);
$pos = strpos($store, "Thank you for logging in");
if($pos === FALSE) RETURN 0;
else RETURN 1;
}
if(vBulletinLogin("****","****")) echo "Logged In";
else echo "Failed to Login check User / Pass";
$url="http://texturl.com";
echo $url."<br>";
//get new HTML document
$html = new DOMDocument();
$html->loadHTMLFile($url);
print $html->saveHTML(); <- shows a login and password box saying I am not logged in.