diff --git a/RoundcubeAutoLogin.php b/RoundcubeAutoLogin.php index cd7330c..ba15bbb 100644 --- a/RoundcubeAutoLogin.php +++ b/RoundcubeAutoLogin.php @@ -70,7 +70,7 @@ public function login($email, $password) if($response_info['http_code'] == 302) { // find all relevant cookies to set (php session + rc auth cookie) - preg_match_all('/Set-Cookie: (.*)\b/', $response, $cookies); + preg_match_all('/set-cookie: (.*)\b/i', $response, $cookies); $cookie_return = array(); @@ -147,7 +147,8 @@ private function _get_token() // set your roundcube domain path -$rc = new RoundcubeAutoLogin('http://domain.com/roundcube/'); +$rc = new RoundcubeAutoLogin('https://www.example.com/'); + $cookies = $rc->login($rcuser, $rcpass); // now you can set the cookies with setcookie php function, or using any other function of a framework you are using @@ -160,5 +161,8 @@ private function _get_token() // and redirect to roundcube with the set cookies $rc->redirect(); } +else{ + echo 'Login failed, please check your credentials'; +} ?>