What's the error in this PHP code ? Desperate for help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpcoder85
Forum Newbie
Posts: 3
Joined: Wed Dec 07, 2011 12:48 am

What's the error in this PHP code ? Desperate for help

Post by phpcoder85 »

Ok , here is a short php code . I'm trying to pull my friends from twitter using the Twitter API with PHP , however , nothing gets displayed on the screen except for my NAME and my Twitter Picture . Can someone please tell me why it won't display my friends on twitter. I've been struggling to trigger the error for two days now .... Below is the code

<?php
include 'lib/EpiCurl.php';
include 'lib/EpiOAuth.php';
include 'lib/EpiTwitter.php';
include 'lib/secret.php';
$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);

$twitterObj->setToken($_GET['oauth_tok…
$token = $twitterObj->getAccessToken();
$twitterObj->setToken($token->oauth_to… $token->oauth_token_secret);

// save to cookies
//setcookie('oauth_token', $token->oauth_token);
//setcookie('oauth_token_secret', $token->oauth_token_secret);

$twitterInfo= $twitterObj->get_accountVerify_credentia…
echo "<div class='welcome'>";
echo "<h5> Welcome, {$twitterInfo->name} </h5> <img src=\"{$twitterInfo->profile_image_url}\…
";

try{
$friends = $twitterObj->get_statusesFriends();

echo "<h2>Latest ".$count." Twitter Friends</h2>";
for ($i = 0; $i < $count; $i++) {
$friend = $friends->users[$i];
echo "<span><a title=\'".$friend->name."\' href='http://twitter.com/\'".
$friend->screen_name."\'><img class='following' src=\'".$friend->
profile_image_url."\' alt=\'".$friend->screen_name."\' height='48'
width='48' /></a>";
}
}
catch(EpiTwitterException $e) { echo "<p>You have no friends to ";}
?>
maxx99
Forum Contributor
Posts: 142
Joined: Mon Nov 21, 2011 3:40 am

Re: What's the error in this PHP code ? Desperate for help

Post by maxx99 »

Where is $count variable set before use?

Code: Select all

echo "<h2>Latest ".$count." Twitter Friends</h2>";
for ($i = 0; $i < $count; $i++) {
Post Reply