Im using class.twitter.php (http://emmense.com/php-twitter/documentation/v11-methods-available/)
Im using this code:
$summize = new summize;
$search = $summize->search('#test');
echo "<pre>";
print_r($search);
echo "</pre>";
And the output is:
stdClass Object
(
[results] => Array
(
[0] => stdClass Object
(
[profile_image_url] => http://a1.twimg.com/profile_images/327884498/Tobias_Zielke_ums_logo_normal.jpg
[created_at] => Sun, 03 Jan 2010 10:47:14 +0000
[from_user] => tobiaszielke
[to_user_id] =>
[text] => Ich hoffe unser See ist nicht zugefroren #Trocki #Waterproof #Test
[id] => 7329402210
[from_user_id] => 27862585
[geo] =>
[iso_language_code] => de
[source] => <a href="http://ubertwitter.com" rel="nofollow">UberTwitter</a>
)
....
How can I take the [from_user], [text], and write it to a f开发者_运维百科ile?
$text = $search['results'][0]['from_user'] . ': ' . $search['results'][0]['text'];
file_put_contents('file.txt', $text);
Use $search->results[0]->from_user
and $search->results[0]->text
.
To write that to a file take a look at file_put_contents().
精彩评论