Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
    /**
     * コマンドラインオプションのセット
     *
     * @param $argc
     * @param $argv
     * @return Console_CommandLine_Result
     */
    static function parse_options($argc, $argv)
    {
        require_once 'Console/CommandLine.php';
        $parser = new Console_CommandLine(array(
            'description' => 'twitterとmixiボイス間でメッセージの転送を行うスクリプトです。',
            'version' => 'unknown'));
        
        if (is_file(dirname(dirname(__FILE__)) . DS . 'VERSION')) {

            // VERSIONファイルからバージョン番号を取得
            $parser->version = trim(file_get_contents(dirname(dirname(__FILE__)) . DS . 'VERSION'));
            
        }
        
        require_once('TW2MV' . DS . 'Configure.php');
        // オプションのセット
        TW2MV_Configure::set_commandline_parser($parser);

        // 引数の追加
        $parser->addArgument('config_files', array(
            'optional'    => true,
            'multiple'    => true,
            'description' => '設定ファイル'));

        // パーサの実行
        try {
            $result = $parser->parse($argc, $argv);
            return $result;

        } catch (Exception $e) {
            $parser->displayError($e->getMessage());

        }
    }
Ejemplo n.º 3
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']);
    }