<?php
function get_twitter(){
$feed = simplexml_load_file('http://search.twitter.com/search.atom?geocode=51.506325%2C-0.127144%2C10.0mi%23london%22&lang=en&rpp=5');
if ($feed) {
foreach ($feed->entry as $item) {
$date = date("D, dS M Y g:i:sA T", strtotime($item->published));
echo '<a href="' . $item->link->attributes()->href . '">' . $item->title . '</a>'.'<br />' . $date . '<br />';
}
}
else
echo "Cannot find Twitter feed!";
}
?>
But when I have tried to call this function from another PHP script it doesn't display the results on the page.
switch ($currentPage) {
case 'twitterFeed.php':
echo get_twitter();
break;
default:
echo 'Sorry. This content is currently unavailable';
break;
}
I have pasted the code into the section where it is being called and the results are displayed correctly, its just when I try and call the function that nothing is displayed on the page.
Thanks in advance.

New Topic/Question
Reply



MultiQuote





|