2012-11-06 94 views

回答

2
//use Codeigniter-TwitterOAuth 
//https://github.com/MunGell/Codeigniter-TwitterOAuth 
//download url: https://github.com/MunGell/Codeigniter-TwitterOAuth/archive/master.zip 
//Usage 

    // There are two ways to load library to Codeigniter. Automatically within ./config/autoload.php or directly in your controller by adding this line: 

    $this->load->library('twitteroauth'); 

    //Create an instance: 

    $connection = $this->twitteroauth->create($consumer, $consumer_secret, $access_token, $access_token_secret); 

    //Verify your authentication details: 

    $content = $connection->get('account/verify_credentials'); 

    //Send a message: 

    $data = array(
     'status' => $message, 
     'in_reply_to_status_id' => $in_reply_to 
    ); 
    $result = $connection->post('statuses/update', $data);