Jump to content

cURL problem and facebook login


kevinkhan

Recommended Posts

I am getting the following error when i run the bellow script

 

Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /usr/local/pem/vhosts/100175/webspace/httpdocs/corkdesigns.ie/facebook/wall/testing.php on line 46 fetching.. Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /usr/local/pem/vhosts/100175/webspace/httpdocs/corkdesigns.ie/facebook/wall/testing.php on line 23

 

 

define("COOKIE_FILE", "cookies.txt");


$email = 'xxxxxxxx';
$pass= 'xxxxxxxxx';



if(file_exists(COOKIE_FILE)) {
unlink(COOKIE_FILE);
}

	$qryString = 'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&locale=en_US&email='.urlencode($email).'&pass='.urlencode($pass).'&pass_placeholder=&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84';

  if (fb_login($email,$pass)){

$ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?login_attempt=1');
 curl_setopt($ch, CURLOPT_POSTFIELDS,$qryString);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
 curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE);
 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)");
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 $page = curl_exec($ch);

}


echo $page;



function fb_login($login_email, $login_pass){

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?login_attempt=1');
 curl_setopt($ch, CURLOPT_POSTFIELDS,'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&locale=en_US&email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&pass_placeholder=&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84');
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
 curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)");
$html = curl_exec($ch);
 $err = 0;
 $err = curl_errno($ch); 
 curl_close($ch);

 if ($err != 0){
 echo 'error='.$err."\n";
 return(false);
 } else {
 echo 'fetching..';
 //echo $html;
 return(true);
}
}

 

What could the problem be??

 

if i set CURLOPT_FOLLOWLOCATION to 0 it still wont work :(

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.