scoohh
scoohh

Reputation: 375

codeigniter auto post to twitter using latest twitter api

I want to post/tweet to my twitter account using my website developed using codeigniter(version 1.7) framework.

How to integrate the latest twitter api to codeigniter?

Upvotes: 0

Views: 2808

Answers (2)

sartajahmed
sartajahmed

Reputation: 81

Below code is worl for me I wrote in core PHP

$this->settings  = array(
    'oauth_access_token'        => "****************",
    'oauth_access_token_secret' => "****************",
    'consumer_key'              => "****************",
    'consumer_secret'           => "****************",
);

$twitter       = new TwitterAPIExchange($this->settings);
$url           = 'https://api.twitter.com/1.1/statuses/update.json';
$requestMethod = 'POST';
$postfields    = array('status' => $message);
$res           = $twitter->buildOauth($url, $requestMethod)
    ->setPostfields($postfields)
    ->performRequest();

Refer this url: http://github.com/j7mbo/twitter-api-php

Upvotes: 0

Pav
Pav

Reputation: 2328

Check out http://www.haughin.com/code/twitter/ or alternately take a look at https://dev.twitter.com/docs/twitter-libraries#php

Upvotes: 2

Related Questions