williwaw Posted September 1, 2008 Share Posted September 1, 2008 Hi all, I have been trying to add my Netfilx rss account que to my blog with no success. I am able/allowed to post script/code in my post so I am not to sure what the problem is? So far this is the code that I have but can't seem to get it to work: <?php //$url should be the url of the Netflix RSS feed you want to display $url = 'http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862'; if ( $url ) { $rss = fetch_rss( $url ); echo “<p>”; echo “My ” . $rss->channel['title'] . “</p>”; echo “<ul>”; foreach ($rss->items as $item) { $href = $item['link']; $title = $item['title']; echo “<li><a href=$href>$title</a></li>”; } echo “</ul>”; } ?> Thanks for taking the time to look! Cheers, Williwaw Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/ Share on other sites More sharing options...
spfoonnewb Posted September 1, 2008 Share Posted September 1, 2008 You just have a single sytax error, however I don't have "fetch_rss" on my server. <?php //$url should be the url of the Netflix RSS feed you want to display $url = 'http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862'; if ( $url ) { $rss = fetch_rss( $url ); echo "<p>My {$rss->channel['title']}</p>"; echo "<ul>"; foreach ($rss->items as $item) { echo "<li><a href={$item['link']}>{$item['title']}</a></li>"; } echo "</ul>"; } ?> Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630674 Share on other sites More sharing options...
williwaw Posted September 1, 2008 Author Share Posted September 1, 2008 Thanks for the help. Apperantly I don't have fetch_rss on my server either...I will get this to work someday Fatal error: Call to undefined function fetch_rss() in /homepages/42/d157514244/htdocs/domain.com/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 7 Thanks again for your help! Cheers, Williwaw Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630687 Share on other sites More sharing options...
spfoonnewb Posted September 1, 2008 Share Posted September 1, 2008 Try this: <?php //$url should be the url of the Netflix RSS feed you want to display $url = 'http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862'; if ( $url ) { $xml = simplexml_load_file($url); echo "<p>My {$xml->channel->title}</p>"; echo "<ul>"; foreach ($xml->channel->item as $item) { echo "<li><a href={$item->link}>{$item->title}</a></li>"; } echo "</ul>"; } ?> Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630692 Share on other sites More sharing options...
williwaw Posted September 1, 2008 Author Share Posted September 1, 2008 Hmmm, 1&1 shared server...dhun, dhun, dhun. I guess they have the 'simple_load_file' function disabled Thanks again for your time. Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration in /homepages/42/d157514244/htdocs/domain.com/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 7 Warning: simplexml_load_file(http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862) [function.simplexml-load-file]: failed to open stream: no suitable wrapper could be found in /homepages/42/d157514244/htdocs/domain.com/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 7 Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862" in /homepages/42/d157514244/htdocs/domain.com/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 7 My Warning: Invalid argument supplied for foreach() in /homepages/42/d157514244/htdocs/domain.com/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 11 Interesting...my info.php() shows SimpleXML Simplexml support enabled Revision $Revision: 1.151.2.22.2.40 $ Schema support enabled Cheers Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630696 Share on other sites More sharing options...
spfoonnewb Posted September 1, 2008 Share Posted September 1, 2008 Generally done for security reasons, but CURL is usually still an option. Try this: <?php //$url should be the url of the Netflix RSS feed you want to display $url = 'http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862'; if ( $url ) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $feed = curl_exec($ch); //Output saved as variable curl_close($ch); $xml = new SimpleXMLElement($feed); echo "<p>My {$xml->channel->title}</p>"; echo "<ul>"; foreach ($xml->channel->item as $item) { echo "<li><a href={$item->link}>{$item->title}</a></li>"; } echo "</ul>"; } ?> Edit: That function is also not disabled, it the allow_url_fopen stuff. You can use the function it just can't be from an external site, it has to be a relative location. Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630715 Share on other sites More sharing options...
williwaw Posted September 1, 2008 Author Share Posted September 1, 2008 Excellent it works very well!!! Thank you very much! I will to give u props on my install... /*This would not of been possible without the expert programming of spfoonnewb at www.phpfreaks.com*/ <?php //$url should be the url of the Netflix RSS feed you want to display $url = 'http://rss.netflix.com/QueueRSS?id=P1010797477721215285005042368212862'; if ( $url ) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $feed = curl_exec($ch); //Output saved as variable curl_close($ch); $xml = new SimpleXMLElement($feed); echo "<p>My {$xml->channel->title}</p>"; echo "<ul>"; foreach ($xml->channel->item as $item) { echo "<li><a href={$item->link}>{$item->title}</a></li>"; } echo "</ul>"; } ?> Thanks again. Cheers, Williwaw Link to comment https://forums.phpfreaks.com/topic/122157-solved-netflix-rss-display-in-blog/#findComment-630722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.