0

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 file?

2
  • just a little curious, are you missing out braces on the $summize = new summize; statement? Commented Jan 3, 2010 at 11:34
  • That how the documentation for class.twitter.php writes it. Commented Jan 3, 2010 at 12:20

2 Answers 2

1
$text = $search['results'][0]['from_user'] . ': ' . $search['results'][0]['text'];
file_put_contents('file.txt', $text);
Sign up to request clarification or add additional context in comments.

Comments

1

Use $search->results[0]->from_user and $search->results[0]->text.

To write that to a file take a look at file_put_contents().

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.