kevinkhan Posted August 1, 2011 Share Posted August 1, 2011 When i run the following code im getting this error file_get_contents(https://www.facebook.com/login.php) [function.file-get-contents]: failed to open stream: Redirection limit reached, aborting What could the problem be.. im trying to get the hidden post variables for logging into facebook.. include('simple_html_dom.php'); $logInPage = file_get_html('https://www.facebook.com/login.php'); foreach($logInPage->find('form input[type=hidden]') as $hidden) { $qryString = $qryString.'&'.$hidden->name.'='.urlencode($hidden->value); } $qryString = 'email='.urlencode($email).'&pass='.urlencode($pass).'&login=Login'.$qryString; Link to comment https://forums.phpfreaks.com/topic/243475-problem-with-file_get_html-function/ Share on other sites More sharing options...
WebStyles Posted August 1, 2011 Share Posted August 1, 2011 if all you need are the hidden values, just go to https://www.facebook.com/login.php right-click on page and select 'view source' and then search for whatever's inside <form..... Link to comment https://forums.phpfreaks.com/topic/243475-problem-with-file_get_html-function/#findComment-1250304 Share on other sites More sharing options...
kevinkhan Posted August 1, 2011 Author Share Posted August 1, 2011 im actually trying to log into facebook. i am using the following code which worked up to yesterday and now doesnt [m] $logInPage = file_get_html('https://login.facebook.com/login.php'); $qryString = ''; foreach($logInPage->find('form input[type=hidden]') as $hidden) { $qryString = $qryString.'&'.$hidden->name.'='.urlencode($hidden->value); } $qryString = 'email='.urlencode($email).'&pass='.urlencode($pass).'&login=Login'.$qryString; curl_setopt($curl_handle, CURLOPT_HEADER, 0); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_handle, CURLOPT_CAPATH, SSL_CA_FILE); curl_setopt($curl_handle, CURLOPT_COOKIEJAR, COOKIE_FILE); curl_setopt($curl_handle, CURLOPT_COOKIEFILE, COOKIE_FILE); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"); //login to initialize cookies curl_setopt($curl_handle, CURLOPT_URL, 'https://login.facebook.com/login.php'); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $qryString); $page = curl_exec($curl_handle); //echo $qryString; unset($page); sleep(5); curl_setopt($curl_handle, CURLOPT_URL, 'https://login.facebook.com/login.php'); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $qryString); $page = curl_exec($curl_handle); htmlOut("https://login.facebook.com/login.php"); htmlOut($page); unset($logInPage,$qryString); // get home page curl_setopt($curl_handle, CURLOPT_POST, 0); curl_setopt($curl_handle, CURLOPT_URL, 'http://www.facebook.com/home.php'); $page = curl_exec($curl_handle);[/m] any ideas how i can solve this. Thanks for your help Link to comment https://forums.phpfreaks.com/topic/243475-problem-with-file_get_html-function/#findComment-1250309 Share on other sites More sharing options...
WebStyles Posted August 1, 2011 Share Posted August 1, 2011 check your logs, you're probably getting something like: Call to undefined function file_get_html() Link to comment https://forums.phpfreaks.com/topic/243475-problem-with-file_get_html-function/#findComment-1250312 Share on other sites More sharing options...
kevinkhan Posted August 1, 2011 Author Share Posted August 1, 2011 no sorry i am including the dom file include('simple_html_dom.php'); Link to comment https://forums.phpfreaks.com/topic/243475-problem-with-file_get_html-function/#findComment-1250314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.