Service_Twitterの認証エラー

このQ&Aのポイント
  • xampp環境を立ち上げローカルPCでpearを使ってインストールし、non-objectエラーが発生。
  • 0.5.1をインストールしたら、エラーが出ない代わりに、Unauthorizedというエラーが発生。
  • IDとパスワードは確認済みだが、認証エラーが解消しない。
回答を見る
  • ベストアンサー

Service_Twitterの認証エラー

http://oshiete.nikkeibp.co.jp/qa6325339.html に引き続き質問します。 xampp環境を立ち上げローカルPCでpearを使ってインストールし、 同じソースを入力したのですが、non-objectエラーは同じでした。 http://uenomemo.blog31.fc2.com/blog-category-28.html を参考にして、0.5.1をインストールしたら、 このエラーが出ないかわりに、 エラーをCatchして、Unauthorizedというエラーが出ます。 何度もIDをパスワードを確認しているのですが、 あってます。 どうしたらいいのでしょうか。 pearでインストールの際にwarningが出ていましたので、添付します WARNING: running in safe mode requires that all files created be the same uid as the current script. PHP reports this script is uid: 0, and current user is: Owner downloading Services_Twitter-0.5.1.tgz ... Starting to download Services_Twitter-0.5.1.tgz (38,464 bytes) ..........done: 38,464 bytes WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update WARNING: failed to download pear.php.net/HTTP_Request2 within preferred state "stable", will instead download version 0.5.2, stability "alpha" Did not download optional dependencies: pear/HTTP_OAuth, use --alldeps to download automatically pear/Services_Twitter can optionally use package "pear/HTTP_OAuth" (version >= 0.1.2) install ok: channel://pear.php.net/Services_Twitter-0.5.1

  • PHP
  • 回答数1
  • ありがとう数2

質問者が選んだベストアンサー

  • ベストアンサー
回答No.1

おそらく、最近の Twitter の認証形式である OAuth に対応していないのでしょう。 http://labs.transrain.net/products/services_twitter/ にも、 > xAuth/oAuth 対応型を開発中。PHP 5.2以降用になる予定です。 > 本家PEAR版と区別する為に名称を変更します。→Tr_Twit とアナウンスされていますから。 Twitter は、2010年8月以降、OAuth という認証形式しか使えないようになりました。 それ以前は、Basic 認証も使用可能でしたが、8月以降、「Basic 認証でログインしても、「Unauthorized」を返すようになっています。 というわけで、このままのライブラリでは、使えないということだと思います。

yamato-g
質問者

お礼

なるほどー。ありがとうございました。

関連するQ&A

  • PEARのパッケージのパスの変更方法

    さくらレンタルサーバで、以下の手順でPEARをインストールしました。 http://www.seo-maniax.com/high-rank/sakura-pear/ 次に以下のコマンドを実行しました。 pear channel-update pear.php.net pear install Net_URL2-2.0.0 pear install HTTP_Request2-0.5.1 pear install HTTP_OAuth-0.2.3 そして、/home/ユーザ名/pear/HTTP/Consumer.phpを使ったプログラムで、以下のエラーが。 Warning: require_once(HTTP/OAuth.php) [function.require-once]: failed to open stream: No such file or directory in /home/ユーザ名/pear/HTTP/OAuth/Consumer.php on line 24 Fatal error: require_once() [function.require]: Failed opening required 'HTTP/OAuth.php' (include_path='.:/home/ユーザ名/pear/PEAR') in /home/ユーザ名/pear/HTTP/OAuth/Consumer.php on line 24 line 24は、require_once 'HTTP/OAuth.php'; となっており、正しいパスは'../OAuth.php'なので、正しくインストールしたいのですが、どうすれば良いのでしょうか?

    • ベストアンサー
    • PHP
  • PHPのPEARのServices_Twitterのエラーについて

    PHPのPEARのServices_Twitterのエラーについて PHPでtwitterAPIを扱いたいと思い、PEARのServices_Twitterを使っています。 しかし、どのようなスクリプトを書いても、「Unsupported endpoint statuses」という エラーメッセージが出る一方で、動きません。 スクリプトミスの可能性も当然あるのですが、多くのWEBサイトにある多数の スクリプトサンプルを試してみたのですが、全て上記エラーのみが表示される状況で、 スクリプトミスというのがすこし考えがたい状況です。 レンタルサーバを使っていまして、twitterAPIへは、OAuth認証の結果をもとに、 Services_Twitterのインスタンスを作成しています。 Services_Twitter自体はしっかり動いているので、 インクルードのミスなどはないと思いますが、レンタルサーバはPEARないので、 手動インストールしてインクルードしています。 以上の状況から、スクリプトミスではない場合、考えられるエラー原因について 想定できることがありましたら、教えていただけると嬉しいです。 ご報告内容が不足している場合は、申し訳ございません。 ご指摘いただければ幸いです。 それでは、恐れ入りますが、宜しくお願いいたします。

    • ベストアンサー
    • PHP
  • PEAR installでエラー

    PEARのパッケージをinstallしようとしたところ、 WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update Cannot install, php_dir for channel "pear.php.net" is not writeable by the current user [root@cn-wedding pear]# pear channel-update pear.php.net と、エラーになったので、 pear channel-update pear.php.net を実行したのですが、 Retrieving channel.xml from remote server となったまま応答がありません。 何か設定が間違っているのでしょうか?全く検討もつきません・・

    • 締切済み
    • PHP
  • twitterのbot作成についての質問です。

    twitterのbot作成についての質問です。 http://pha22.net/twitterbot/1.4/adv_id.phpのサイト様を参考にして、botを作ろうとしています。 サーバーは @pages で、アップロードをしたのですが、「bot.php」にアクセスすると、「Twitterへのpostに成功しました。」という文は表示されずに Warning: require_once(HTTP/OAuth/Consumer.php) [function.require-once]: failed to open stream: No such file or directory in /usr/local/www/htdocs/(ユーザー名)/public_html/twitbot/EasyBotter.php on line 49 Fatal error: require_once() [function.require]: Failed opening required 'HTTP/OAuth/Consumer.php' (include_path='.:/usr/local/lib/php:/usr/local/www/htdocs/(ユーザー名)/public_html/twitbot/PEAR') in /usr/local/www/htdocs/(ユーザー名)/public_html/twitbot/EasyBotter.php on line 49 となってしまいます。同じような質問をされた方がいて回答には、 HTTP/OAuth/Consumer.phpが、include_pathない為エラーになってます。 http://www.msng.info/archives/2010/01/twitter_api_oauth_with_php.php のようにpearコマンドでインストールするか、include出来る場所にファイルを直接置くかする必要がありますよ。 という事が書かれていたのですが、初心者な為、いまいち理解に欠けてしまいました。 詳しく分かりやすいように説明していただきたいです。こちらも出来る限りの事は調べるようにいたしますので、よろしくお願いします。

    • ベストアンサー
    • PHP
  • PEAR_Infoのインストールでエラー

    PEAR_Infoのインストールを試みましたが、エラーメッセージが表示されてインストールできません。 バージョンが違う旨のエラーメッセージだと思うのですが、対処方法を教えて下さい。バージョンは問いません。 入力内容→C:\>pear install PEAR_Info エラーメッセージの内容     ↓ WARNING: channel "pear.php.net" has updated its protocols,use "channel-update pear.php.net" to update pear/PEAR_Info requires PEAR Installer (version >= 1.4.11),installed version is 1.4.9 pear/PEAR_Info requires package "pear/PEAR" (version >=1.4.11),installed version is 1.4.9 No valid packages found install failed 宜しくお願いします。

    • 締切済み
    • PHP
  • Twitter Oauth認証がエラーになります。

    現在Twitterログインアプリを作りいのですが、 下記のようなエラーが出てしまいます。 Fatal error: Class 'Codebird' not found in /var/www/html/callback.php on line 8 認証にはcodebird.phpというライブラリを使っております。 (https://github.com/mynetx/codebird-php 下記コードのソースもこちらです。) 分かる方がいらっしゃれば教えて原因を教えて頂けると非常に助かります。 宜しくお願い致します。。 以下仕様 <a href="callback.php">twitterでログイン</a> これをクリックすると、callback.phpに飛び認証が行われるという具合です。 callback.php内ではconfig.phpとcodebird.phpを読み込んでます。 以下callback.phpコード var_dump($me); が実行出来ず、先に記したエラーが起きます。 <?php require_once('config.php'); require_once('codebird.php'); session_start(); Codebird::setConsumerKey(CONSUMER_KEY, CONSUMER_SECRET); //上記の定数はconfig.phpに記載しており、スペルミスはありません。 $cb = Codebird::getInstance(); if (! isset($_GET['oauth_verifier'])) { // gets a request token $reply = $cb->oauth_requestToken(array( 'oauth_callback' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] )); // stores it $cb->setToken($reply->oauth_token, $reply->oauth_token_secret); $_SESSION['oauth_token'] = $reply->oauth_token; $_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; // gets the authorize screen URL $auth_url = $cb->oauth_authorize(); header('Location: ' . $auth_url); die(); } else { // gets the access token $cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $reply = $cb->oauth_accessToken(array( 'oauth_verifier' => $_GET['oauth_verifier'] )); // $_SESSION['oauth_token'] = $reply->oauth_token; // $_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; $cb->setToken($reply->oauth_token, $reply->oauth_token_secret); $me = $cb->account_verifyCredentials(); var_dump($me); exit; }

    • 締切済み
    • PHP
  • PHPを使用してTWITTERにつぶやきを投稿する簡単な自分用のサイト

    PHPを使用してTWITTERにつぶやきを投稿する簡単な自分用のサイトを作ろうと思い、PEARをインストールしてTwitter.phpを使用して作っていたらエラーが出て困りました。 エラー内容は下記の通りです。 Warning: require_once(Services/Twitter/Connector.php) [function.require-once]: failed to open stream: No such file or directory in /home/USRENAME/www/Services/Twitter.php on line 23 Fatal error: require_once() [function.require]: Failed opening required 'Services/Twitter/Connector.php' (include_path='/home/USERNAME/www/PEAR') in /home/USERNAME/www/Services/Twitter.php on line 23 と表示されます。 使用している環境は「さくらのレンタルサーバー」スタンダード PHPのバージョンはPHP 5.2.12 [標準のPHP] (CGI版) です。 index.iniは include_path = "/home/USERNAME/www/PEAR" と記載しました。 何分PHPもさほど詳しくないのでエラー内容がわかりません。 どのような対応をしたら良いのかわからなくなり、ここに来ました。 何卒ご指導や参考になるサイトを教えてください。

    • ベストアンサー
    • PHP
  • Twitter codebirdでエラーがでます

    http://dotinstall.com/lessons/tw_connect_php_v2 上記のサイトを参考にツイッターでログインするサービスを作りたいのですが、 下記のようなエラーがでてしまいます。 Fatal error: Uncaught exception 'Exception' with message 'Error 77 while validating tificate.' in C:\xampp\htdocs\tw\codebird.php:923 Stack trace: #0 C:\xampp\htdocs\tw\codebird.php(294): Codebird\Codebird->_callApi('POST', 'oauth/request_t...', 'oauth/request_t...', Array, false, false) #1 C:\xampp\htdocs\tw\callback.php(15): Codebird\Codebird->__call('oauth_requestTo...', Array) #2 C:\xampp\htdocs\tw\callback.php(15): Codebird\Codebird->oauth_requestToken(Array) #3 {main} thrown in C:\xampp\htdocs\tw\codebird.php on line 923 認証にはcodebird.phpというライブラリを使っています。 https://github.com/mynetx/codebird-php <a href="callback.php">twitterでログイン</a> これをクリックすると、callback.phpに飛び認証が行われるという具合です。 callback.php内ではconfig.phpとcodebird.phpを読み込んでます。 以下callback.phpコード <?php require_once('config.php'); require_once('codebird.php'); session_start(); \Codebird\Codebird::setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET'); $cb = \Codebird\Codebird::getInstance(); if (!isset($_SESSION['oauth_token'])) { // get the request token $reply = $cb->oauth_requestToken(array( 'oauth_callback' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] )); // store the token $cb->setToken($reply->oauth_token, $reply->oauth_token_secret); $_SESSION['oauth_token'] = $reply->oauth_token; $_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; $_SESSION['oauth_verify'] = true; // redirect to auth website $auth_url = $cb->oauth_authorize(); header('Location: ' . $auth_url); die(); } elseif (isset($_GET['oauth_verifier']) && isset($_SESSION['oauth_verify'])) { // verify the token $cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); unset($_SESSION['oauth_verify']); // get the access token $reply = $cb->oauth_accessToken(array( 'oauth_verifier' => $_GET['oauth_verifier'] )); // store the token (which is different from the request token!) //$_SESSION['oauth_token'] = $reply->oauth_token; //$_SESSION['oauth_token_secret'] = $reply->oauth_token_secret; $cb->setToken($reply->oauth_token, $reply->oauth_token_secret); $me = $cb->account_verifyCredentials(); var_dump($me); exit; // send to same URL, without oauth GET parameters header('Location: ' . basename(__FILE__)); die(); } // assign access token on each page load $cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

    • 締切済み
    • PHP
  • Go-PEARがインストールできない

    Go-PEARをレンタルサーバーにインストールしたいのですが、 途中でエラーが出てインストールできません。 どうしたらインストールできますでしょうか。 http://pear.php.net/go-pear を go-pear.php として保存。そしてレンタルサーバーにアップ。 http://mydomain/go-pear.php にアクセス Bootstrapping Archive/Tar.php............ Tar.phpのインストールでエラーが出ているようです。 「エラー内容」 Warning: fopen() [function.fopen]: SAFE MODE Restriction in effect. The script whose uid/gid is 266042/600 is not allowed to access mydomain/temp/Archive owned by uid/gid 48/48 in mydomain/go-pear.php on line 1132 Warning: fopen(Archive/Tar.php) [function.fopen]: failed to open stream: Permission denied in mydomain/go-pear.php on line 1132 Warning: rmdir(mydomain/temp) [function.rmdir]: Permission denied in mydomain/go-pear.php on line 1282 could not open Archive/Tar.php for writing

    • 締切済み
    • PHP
  • PHPパッケージHTML_Tableのインストール方法

    PHPのパッケージHTML_Tableを下記のようにインストールしようとしましたが 下記エラーメッセージが出力されインスールができません。 C:\php>pear install -o HTML_Table downloading HTML_Table-1.7.5.tgz ... Starting to download HTML_Table-1.7.5.tgz (14,789 bytes) .....done: 14,789 bytes No handlers for package.xml version 2.0 どなたかこの問題を解決する方法を教えていただけないでしょうか? PHPのバージョンは5.0.4です。よろしくお願い致します。

    • ベストアンサー
    • PHP

専門家に質問してみよう