twitter - How to post statuses for users whos allow it for my application? -


on website, want allow users, authorized twitter, post review on own wall(page) in twitter, application. can page this

$connection = new twitter_twitteroauth(  $this->config->twitter->consumer_key, $this->config->twitter->consumer_secret, $this->config->twitter->token, $this->config->twitter->token_secret  );  $connection->post('statuses/update', array('status' => $data['text'] . $data['name'] . "." . chr(13) . chr(10) . "more details " . $data['link'] .'?review='. $data['id'])); 

so need post same accounts ? need set account(where want post status application) id or need set other

$this->config->twitter->token, $this->config->twitter->token_secret 

with token , token_secret receive when user login application ?

thanks help.

for account should sleep(//someseconds); if don't have throttle in library, same other account. looks account yours, because in code posted see authorization user (callback). if guess right , you're using app authorization, need have authorized own app other account, ideally there should no need reset tokens. if doesn't work, try reset them. if still doesn't work, trick have 2 applications (each account has application, each account uses own app post). however, please bear in mind a) twitter counts overall number of calls server , b) i'm not sure multiple accounts.

edit: if instead need post users have authorized app , online on website, store tokens in session (as abraham williams in library). in case, need reset variables reflect change of tokens. sample code, williams:

/* user access tokens out of session. */ $access_token = $_session['access_token']; $access_token_secret = $_session["access_token_secret"]; /* create twitteroauth object consumer/user tokens. */ $connection = new twitteroauth(consumer_key, consumer_secret, $access_token,   $access_token_secret); $message ="your message"; $parameters = (array('status' =>$message)); $status = $connection->post('statuses/update', $parameters); twitteroauth_row('statuses/update', $status, $connection->http_code, $parameters); if ($http_code = 200){ // echo "done!";    } else {    // echo "oops!";     } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -