I am writing a web app and I am trying access a RSS feed from the financial times. However when I run my code I get the following error. I was hoping someone could tell me where I've went wrong.
function getFtRSS(){
//Create a object to parse XML input from Finanial Time's UK companies RSS feed
$rssFeed = new DOMdocument();
//Gather the information and load it into the object
$rssFeed->load('http://www.ft.com/rss/companies/uk');
$articles = array();
//Lookp through all elements in the XML document
foreach($rssFeed->getElementsByTagName('item') as $newsArtcle){
$title = $newsArtcle->getElementsByTagName('title')->item(0)->nodeValue;
$desc = $node->getElementsByTagName('description')->item(0)->nodeValue;
$link = $node->getElementsByTagName('link')->item(0)->nodeValue;
$date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
echo '<li class="list-group-item news-item" onclick="window.location=\'$link\'">
<h3 class=\'top-element\'>$title</h3>
<h4>$desc</h4>
<h5>$date</h5>
</li>';
}
}
I get the following error from my program:
Warning: DOMDocument::load(http://www.ft.com/rss/companies/uk): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/ubuntu/workspace/MOT/includes/functions.php on line 46