I want to get links from a rss url . This is my code :
$doc = new DOMDocument();
$doc->load("http://www.alef.ir/rssdx.gmyefy,ggeltshmci.62ay2x.y.xml");
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$title = $node->getElementsByTagName('title')->item(0)->nodeValue;
$title=strip_tags($title);
$link=$node->getElementsByTagName('link')->item(0)->nodeValue;
}
I've used this code for several others URLs and all of them worked but on this one I get:
Warning:
DOMDocument::load(http://www.alef.ir/rssdx.gmyefy,ggeltshmci.62ay2x.y.xml): failed to open stream: HTTP request failed!
HTTP/1.1 403 Forbidden in /home/xxxxxxx/domains/xxxxxxx/public_html/data.php on line 14
Warning:
DOMDocument::load(): I/O warning: failed to load external entity "http://www.alef.ir/rssdx.gmyefy,ggeltshmci.62ay2x.y.xml"
in /home/xxxxxxx/domains/xxxxxxx/public_html/data.php on line 14
http://www.alef.ir/rssdx.gmyefy,ggeltshmci.62ay2x.y.xml
Line 14 is:
$doc->load("http://www.alef.ir/rssdx.gmyefy,ggeltshmci.62ay2x.y.xml");
Could you help me? Why does this request give me an error?
Thanks