PHP - How to login through curl

James Tyreece Source

I would like help on logging into a site with curl

function loginV2($user, $pass) {
    $curl = curl_init("https://www.binweevils.com/login/");
    curl_setopt($curl, CURLOPT_POST, true);
    define('USER_AGENT', 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36');
    curl_setopt($curl, CURLOPT_USERAGENT, USER_AGENT);
    $userid = $user;
    $password = $pass;
    $remememberMe = "on";
    $formtoken = o2_genhash("$userid"."$password");
    curl_setopt($curl, CURLOPT_POSTFIELDS, "userID=".$user."&password=".$pass."&rememberMe=on"."&form_token=".$formtoken);
    curl_setopt($curl, CURLOPT_HEADER, true);
         $header = curl_exec($curl);
   curl_close($curl);
}

this is the data thats posted to the URL above this is the data thats posted to the URL above

and for some reason i cant login.

phpcurlcookieslogin

Answers

comments powered by Disqus