Jump to content

param01

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

param01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I want to auto login to remote site from my site using curl,i am using a curl script that login on same page with showing only html page,created cookie on my server too but i want to create cookie on remote server so that if i will open that remote site URL on my browser on another tab it shows me as logged-in. Here is a code i am using $fp = fopen("cookie.txt", w); fclose($fp); echo 'still loading <br/>'; if (fb_login($login_email,$login_pass)){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://askabookdealer.com/logincode.php?redirected=1&referrer=index'); curl_setopt($ch, CURLOPT_POSTFIELDS,'txtuname='.$login_email.'&txtpass='.$login_pass.'&x=15&y=6&login_submit='); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/cookie.txt'); 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); curl_close($ch); echo $html; } function fb_login($login_email, $login_pass){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://askabookdealer.com/logincode.php?redirected=1&referrer=index'); curl_setopt($ch, CURLOPT_POSTFIELDS,'txtuname='.$login_email.'&txtpass='.$login_pass.'&x=15&y=6&login_submit='); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/cookie.txt'); 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..'; return(true); } } Please Help,how can i get the solution for this,Thanks.
×
×
  • 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.