コード例 #1
0
ファイル: Mixi.php プロジェクト: nojimage/twitter2mixivoice
 /**
  * Login to mixi
  *
  * @param $email
  * @param $password
  * @return unknown_type
  */
 public function login($email, $password)
 {
     // パスワードを復号化
     $password = TW2MV_Configure::decrypt($password);
     
     $next_url = '/home.pl';
     $datas = compact('email', 'password', 'next_url');
     $this->post_request(self::$HTTPS_URI . 'login.pl', $datas);
 }
コード例 #2
0
    /**
     * OAuth Access Tokenの取得
     *
     * @since version 2.1.0
     */
    protected function _getAccessToken()
    {
        $params = array(
            'x_auth_mode' => 'client_auth',
            'x_auth_username' => $this->config->twitter_username, 
            'x_auth_password' => TW2MV_Configure::decrypt($this->config->twitter_password));
         
        $response = $this->oauth->sendRequest(self::$XAUTH_ACCESS_TOKEN_REQUEST_URL, $params, HTTP_Request2::METHOD_POST);

        if ($response->getStatus() !== 200) {
            throw new Exception($response->getBody(), $response->getStatus());
        }

        // レスポンスデータを解析
        $access_token_info = array();
        parse_str($response->getBody(), $access_token_info);

        // 設定ファイルへ保存
        $this->config->saveTwitterAccessToken($access_token_info['oauth_token'], $access_token_info['oauth_token_secret']);
    }