Jump to content

problem with file_get_html function


kevinkhan

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.