The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

roundcube login using curl

Discussion in 'General Discussion' started by Anupam Baruah, Oct 19, 2011.

  1. Anupam Baruah

    Anupam Baruah Registered

    Joined:
    Oct 18, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi...
    Myself anupam baruah.I want to login roundcubemail directly from drupal 7.8.In this case drupal username and password must be same as roundcube username and password..ie,.....when i log into drupal7 automaticalyy login to roundcubemail using same login info....i have used curl for roundcube login.but it does not work properly......
    plese help me.....

    below i attached curl code for roundcubelogin....

    $user1='user@domain.com';
    //echo $user;
    $password='password';
    $url = "http://localhost/roundcubemail/";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,0); // return into a variable
    curl_setopt($ch, CURLOPT_TIMEOUT, 0); // times out after Ns
    curl_setopt($ch, CURLOPT_POST, 1); // set POST method
    curl_setopt($ch, CURLOPT_POSTFIELDS, "_user=".$user1."&_pass=".$password."&ajax=1&_action=login"); // add POST fields
    curl_setopt($ch, CURLOPT_FAILONERROR, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_COOKIEFILE, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_exec($ch); // run the whole process
    //curl_close($ch);
    //if(curl_exec($ch)){
    // drupal_goto($url);
    //}
    //
     
    #1 Anupam Baruah, Oct 19, 2011
    Last edited by a moderator: Oct 19, 2011
Loading...

Share This Page