はじめに
何がわからないかが分かっていないので、随時必要な情報を教えてください。
OAuth初心者です。
質問
Twitterでサービスにログインする機能を作りたいと思い、以下のサイト様を丸コピーしました。
http://noumenon-th.net/programming/2016/03/08/twitteroauth/
※サーバのPHPのバージョンが7系なので、twitteroauthは、0.7.2を使っています。
しかし、実行してみるとlogin.phpで画面が真っ白のまま動きません。
挙動を調べてみると、どうやら、
php
1//TwitterOAuthのインスタンスを生成し、Twitterからリクエストトークンを取得する 2$connection = new TwitterOAuth(Consumer_Key, Consumer_Secret); 3$request_token = $connection->oauth("oauth/request_token", array("oauth_callback" => Callback));
で、処理が止まってしまっているようです。
これはどのようにすれば修正できるのでしょうか?
お知恵をお貸しください、
よろしくお願いいたします。
サーバ情報
・Ubuntu Server:16.10
・PHPバージョン:PHP 7.0.8-3ubuntu3 (cli) ( NTS )
エラー情報(追記)
Notice: Use of undefined constant CURLOPT_CAINFO - assumed 'CURLOPT_CAINFO' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 353 Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 354 Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 355 Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 356 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 357 Notice: Use of undefined constant CURLOPT_SSL_VERIFYHOST - assumed 'CURLOPT_SSL_VERIFYHOST' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 358 Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 359 Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 360 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 361 Notice: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 362 Notice: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 371 Notice: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 386 Notice: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 387 Fatal error: Uncaught Error: Call to undefined function Abraham\TwitterOAuth\curl_init() in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php:402 Stack trace: #0 /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php(334): Abraham\TwitterOAuth\TwitterOAuth->request('https://api.twi...', 'POST', 'Authorization: ...', Array) #1 /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php(135): Abraham\TwitterOAuth\TwitterOAuth->oAuthRequest('https://api.twi...', 'POST', Array) #2 /home/USERID/public_html/twitterlogin/login.php(18): Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/request_t...', Array) #3 {main} thrown in /home/USERID/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 402
サーバエラー(追記2)
Fatal error: Uncaught Abraham\TwitterOAuth\TwitterOAuthException: <?xml version="1.0" encoding="UTF-8"?> <hash> <error>Desktop applications only support the oauth_callback value 'oob'</error> <request>/oauth/request_token</request> </hash> in /home/USER_NAME/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php:138 Stack trace: #0 /home/USER_NAME/public_html/twitterlogin/login.php(18): Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/request_t...', Array) #1 {main} thrown in /home/USER_NAME/public_html/twitterlogin/twitteroauth/src/TwitterOAuth.php on line 138