Вот мое решение.Он использует библиотеку Авраама Twitter Oauth PHP: https://github.com/abraham/twitteroauth
Требуется, чтобы вы знали атрибут screen_name пользователя Twitter, а также атрибут id_str рассматриваемого твита.Таким образом, вы можете получить произвольную ленту разговоров от любого произвольного пользовательского твита:
* ОБНОВЛЕНИЕ: Обновленный код для отражения доступа к объектам против доступа к массиву:
function get_conversation($id_str, $screen_name, $return_type = 'json', $count = 100, $result_type = 'mixed', $include_entities = true) {
$params = array(
'q' => 'to:' . $screen_name, // no need to urlencode this!
'count' => $count,
'result_type' => $result_type,
'include_entities' => $include_entities,
'since_id' => $id_str
);
$feed = $connection->get('search/tweets', $params);
$comments = array();
for ($index = 0; $index < count($feed->statuses); $index++) {
if ($feed->statuses[$index]->in_reply_to_status_id_str == $id_str) {
array_push($comments, $feed->statuses[$index]);
}
}
switch ($return_type) {
case 'array':
return $comments;
break;
case 'json':
default:
return json_encode($comments);
break;
}
}