舊版twitter API 1 大約在 2013/6/11左右不能用了
http://stackoverflow.com/questions/12684765/twitter-api-returns-error-215-bad-authentication-data
新版的需要做認證(authentication)才能存取
1. 在 https://dev.twitter.com/ 登入你twitter帳號
2. 滑鼠移到右上角圖示後點選 My application 進入 https://dev.twitter.com/apps
3. 因為是第一次做的話這邊會出現"Looks like you haven't created any applications yet!"訊息
4. 點選右上角"Create a new application"按鈕
5. 填寫表單後送出
6. 這時候會產生新application
7. 點選下面的"Create my access token"產生token和token secret
8. https://dev.twitter.com/docs/twitter-libraries
Twitter API 各語言去串接的方法
我是使用php版本 https://github.com/abraham/twitteroauth
安裝perl版本出現問題...
cpan > install Net::Twitter
阿山哥:
去cpan下載Net::Twitter的tar.gz檔後手動用Build安裝,有缺的模組進cpan後一個一個裝,最後就能裝好了..
http://search.cpan.org/~mmims/Net-Twitter-4.00006/lib/Net/Twitter.pod
$ perl Build.PL
( 有缺模組,失敗的錯誤訊息:
Checking prerequisites...
requires:
! Carp::Clan is not installed
! Data::Visitor::Callback is not installed
! DateTime is not installed
! DateTime::Format::Strptime is not installed
! Devel::StackTrace is not installed
! Moose is not installed
! Moose::Exporter is not installed
! Moose::Meta::Method is not installed
! Moose::Role is not installed
! MooseX::Aliases is not installed
! MooseX::Role::Parameterized is not installed
! Net::OAuth is not installed
! Net::OAuth::Message is not installed
! namespace::autoclean is not installed
build_requires:
! Test::Warn is not installed
進cpan>後一個一個手動裝
)
$ ./Build
$ ./Build test
$ ./Build install
裝好後沒仔細研究他的example要怎麼測試... 因為我已經將php版本改成perl了
另種安裝方法
$ perl Makefile.PL
$ make
$ make test
$ make install
用 $ perl -e "use Net::Twitter;" 看模組有沒有安裝成功
http://alvinalexander.com/perl/edu/articles/pl010015
只下載模組,不安裝的話可以引入路徑
#!/usr/bin/perl
use lib "/home/george/modules";
print "\@INC is @INC\n";
沒有留言:
張貼留言