は私が持っているもの:localhostのポスト/更新データは
でTwitterやPHPアプリで作成した Twitterアプリは、私が欲しい:TwitterのAPIを経由して ポストつぶやき/更新状況を唯一のアプリケーションのアカウントから(!) 。 twitter @はどこにもない、ユーザーはログインしていません。私が試した何
:dev.twitter.comのウェブサイトからのアクセストークンを持つ
https://github.com/abraham/twitteroauthは、
または "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