Twitter Oauth home timeline display with php

Posted by Srinivas Tamada on Stack Overflow See other posts from Stack Overflow or by Srinivas Tamada
Published on 2010-04-27T08:40:15Z Indexed on 2010/04/27 8:43 UTC
Read the original article Hit count: 686

Filed under:
|
|
|

$hometime= $Twitter->get_statusesHome_timeline();

Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects parameter 1 to be string

<?php
        include 'EpiCurl.php';
        include 'EpiOAuth.php';
        include 'EpiTwitter.php';
        include 'key.php';

        $Twitter = new EpiTwitter($consumerKey, $consumerSecret);
        $oauthToken='xxxxxxxxxxxxxxxxxxxxxxx';
        $oauthSecret='xxxxxxxxxxxxxxxxxxxxxxxxx';

             // user switched pages and came back or got here directly, stilled logged in
             $Twitter->setToken($oauthToken,$oauthSecret);
             $user= $Twitter->get_accountVerify_credentials();

       echo "<img src=\"{$user->profile_image_url}\">";
       echo "{$user->name}";


        $hometime= $Twitter->get_statusesHome_timeline();

        $twitter_status = new SimpleXMLElement($hometime);
        foreach($twitter_status->status as $status){
            echo '<div class="twitter_status">';
            foreach($status->user as $user){
                echo '<img src="'.$user->profile_image_url.'" class="twitter_image">';
                echo '<a href="http://www.twitter.com/'.$user->name.'">'.$user->name.'</a>: ';
            }
            echo $status->text;
            echo '<br/>';
            echo '<div class="twitter_posted_at"><strong>Posted at:</strong> '.$status->created_at.'</div>';
            echo '</div>';
        }

             ?>

© Stack Overflow or respective owner

Related posts about php

Related posts about php5