특정 사용자 이름은 PHP를 사용하여 트위터의 API를 쓰기 : 나는에 특정한 타임 라인 스트림을 생성하는 스크립트를 수정하는 방법내가 다음 자습서를 사용하여 트위터의 API를 응용 프로그램을 작성했습니다
http://www.youtube.com/watch?v=GQaPt-gQVRI
사용자는 (내가 응용 프로그램을 작성하기 때문에 내 트위터 자격 증명을 가지고 있기 때문에) 내 사용자의 타임 라인 스트림을 보여줍니다 실행되지 응용 프로그램
감사
는는 PHP 응용 프로그램 내 t의 유효성을 확인하도록 로그인 할 수있는 사용자를 필요로
<?php
require 'tmhOAuth.php'; // Get it from: https://github.com/themattharris/tmhOAuth
// Use the data from http://dev.twitter.com/apps to fill out this info
// notice the slight name difference in the last two items)
$connection = new tmhOAuth(array(
'consumer_key' => 'my key',
'consumer_secret' => 'my secret',
'user_token' => 'my token', //access token
'user_secret' => 'my user secret' //access token secret
));
// set up parameters to pass
$parameters = array();
if ($_GET['count']) {
$parameters['count'] = strip_tags($_GET['count']);
}
if ($_GET['screen_name']) {
$parameters['screen_name'] = strip_tags($_GET['screen_name']);
}
if ($_GET['twitter_path']) { $twitter_path = $_GET['twitter_path']; } else {
$twitter_path = '1.1/statuses/user_timeline.json';
}
$http_code = $connection->request('GET', $connection->url($twitter_path), $parameters);
if ($http_code === 200) { // if everything's good
$response = strip_tags($connection->response['response']);
if ($_GET['callback']) { // if we ask for a jsonp callback function
echo $_GET['callback'],'(', $response,');';
} else {
echo $response;
}
} else {
echo "Error ID: ",$http_code, "<br>\n";
echo "Error: ",$connection->response['error'], "<br>\n";
그래서 API 호출에 새 사용자 이름을 통과하지 않고, 내가 어떻게이 조각을 추가 할 수 있습니다 Witter에 자격 증명은 다음 사용하고 계십니까? 사용자가 로그인 할 수 있도록 스 니펫을 추가하면 api가 사용자의 인증 문자열을 자동으로 채 웁니까?
일부 코드를 표시하는 것은 어떻습니까? 나는 당신의 코드가 어떻게 보이는지 추측하기 위해 많은 사람들이 비디오를 보러 간다. – Novocaine
다른 사용자의 타임 라인을 볼 수 없다고 확신합니다. 그것이 작동하는 방식이 아닙니다. 아시다시피, 프라이버시와 모든 것. 사용자가 앱을 사용하면 사용자가 앱을 볼 수 있도록 자격 증명을 제공합니다. –
죄송합니다. 나는 Novocaine88을 서두 릅니다. 위의 업데이트 된 질문을 참조하십시오. –