我有什麼:在Twitter和PHP應用程序在本地主機郵政/更新數據
創建 Twitter的應用程序,我想什麼:通過Twitter API 後鳴叫/更新狀態僅從應用程序帳戶(!) 。 沒有Twitter @任何地方,沒有用戶登錄,沒有什麼幻想。
我試了一下:
https://github.com/abraham/twitteroauth從dev.twitter.com網站訪問令牌,返回
「POST數據不可用此 令牌」
或類似的東西。
代碼片段我在一些網站上找到:
// Define credentials for the Twitter account
define('TWITTER_CREDENTIALS', 'username:password');
// Set up CURL with the Twitter URL and some options
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://twitter.com/statuses/update.xml?status=test_status');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Twitter uses HTTP authentication, so tell CURL to send our Twitter account details
curl_setopt($ch, CURLOPT_USERPWD, TWITTER_CREDENTIALS);
// Execute the curl process and then close
$data = curl_exec($ch);
curl_close($ch);
// If nothing went wrong, we should now have some XML data
echo '<pre>'.htmlentities(print_r($data, true)).'</pre>';
返回
「基本身份驗證是不是 支持」
是的我已經註冊了我的應用程序與Twitter,不能使用沒有這些鍵的twitteroauth。當您轉到應用程序的設置面板時,您也會獲得應用程序的令牌。 – Inoryy