Jump to content

[PHP] Log into Fiverr using CURL


No replies to this topic

#1 Vick

    Administrator

  • Administrators
  • 34 posts
  • Posted 23 November 2011 - 02:07 AM

    [PHP] Log into Fiverr using CURL

    <?php
    function fiverr_login($username, $password, $url='http://fiverr.com/login')
    {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'user_session[username]='.$username.'&user_session[password]='.$password);
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    $store = curl_exec($ch);
    curl_close($ch); 
    }
    function loadUrl($user, $url='http://fiverr.com/conversations'){
        $cr = curl_init($url);
        curl_setopt($cr, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($cr, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($cr, CURLOPT_RETURNTRANSFER, true);   
        curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($cr, CURLOPT_COOKIEFILE, 'cookie.txt');
        $output = curl_exec($cr);
        curl_close($cr);
        echo $output;	
    }
    // First you run the function 'videobox_login' and pass username, password
    fiverr_login("vick2011", "password");
    // then load a page you want to be loaded once logged in
    loadUrl("vick2011");
    ?>
    






    1 user(s) are reading this topic

    0 members, 1 guests, 0 anonymous users