Basically I am trying to make a site where a user come to the site,
types in their username, song title, artist title, and uploads a song,
this then gets stored in a database along with a random generated
code.
What I am trying to do is make a twitter clone page of the users
profile. eg. if a user has the username blahblah and the random code
in the database is 3hr8e I want it so when I go to
www.mysite.com/twitter.php?pwd=3hr8e
This is what I have tried however I can't get anything to show up. Is
there something I'm doing wrong?
<?php
require ("connect.php");
require ("functions.php");
include("template/twitterheader.php");
// require the twitter library
require "twitter.lib.php";
$pwd = mysql_real_escape_string($_GET['pwd']);
$result = mysql_query("SELECT * FROM songs WHERE pwd='$pwd'");
$screen = mysql_fetch_array($result);
$username = $screen['username'];
// initialize the twitter class
$twitter = new Twitter($username);
// fetch your profile in xml format
$xml = $twitter->getUserTimeline();
/* display the raw xml
echo '<pre>';
echo $xml;
echo '</pre>';*/
$twitter_status = new SimpleXMLElement($xml);
foreach($twitter_status->status as $status){
echo '<div class="twitter_status">';
foreach($status->user as $user){
}
echo $status->text;
echo $user->followers_count;
echo '<br/>';
echo '<div class="twitter_posted_at"><strong>Posted at:</strong> '.
$status->created_at.'</div>';
echo '</div>';
}
include("template/twitterfooter.php");
?>
Function:
function getUserTimeline($options = array(), $format = 'xml') {
return $this->apiCall('statuses/user_timeline', 'get', $format,
$options, true);
}