Twitter 에서 데이터를 가져오는 방법에 대해 설명하고, 1~2개 정도의 실제 예제를 확인합니다.
class TwitterOAuth (cont'd)
- mixed get($url, $parameters = array())
API
- GET account/verify_credentials
- GET statuses/home_timeline
Paging
- count
- since_id
- max_id
- page
Code snippet
- simple query
// Access token 을 포함한 TwitterOAuth object 생성 $connection = new TwitterOAuth($consumer_key, $consumer_secret, $token, $token_secret); // get user profile $user = $connection->get('account/verify_credentials'); // get home timeline $timeline = $connection->get('statuses/home_timeline'); // parameter $params = array('count'=>10); $timeline2 = $connection->get('statuses/home_timeline', $params);
External Links
- https://dev.twitter.com/docs/api : Twitter REST API Resources