简体   繁体   中英

how to tweet using oauth token and secret in php

i can successfully redirect from valid twitter credential and i found this much parameter

[session_id] => ef19487c18256fcc539347e339e800bb
[ip_address] => 127.0.0.1
[user_agent] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
[last_activity] => 1380864503
[user_data] => 
[tw_access_token] => Array
    (
        [oauth_token] => XXXXXXXXXXX
        [oauth_token_secret] => XXXXXXXXX
        [user_id] => 19297XXXXX
        [screen_name] => XXXYYYZZZ
    )

[tw_status] => verified

now i want to tweet using this account, as array says i have oauth_token & secret.

if anybody develop such thing let me direct from this stage.

Since you said you're using tmhoauth below is the format for tweeting.

$tmhOAuth = new tmhOAuth(array(
  'consumer_key' => 'your-consumer-key',
  'consumer_secret' => 'consumer-secret',
  'token' => 'your access token',
  'secret' => 'token secret',
));
$response = $tmhOAuth->request('POST', $tmhOAuth->url('1.1/statuses/update'), array(
 'status' => 'Test message '
));

The token and token secret are available right at the bottom of the page where you've created your application. ( http://dev.twitter.com/apps )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM