Random news feed example
This is very similar to our other feed scripts but has one big important difference , this version has the ability to choose a random news feed from one of 330 available .
The first major difference is that we put all the necessary moreover feed urls in an array and then we generate a random number between 1 and 330 . This is then stored in a variable , instead of supplying a url to our previous moreover script we now supply the value of the variable which will be one of our moreover urls. Whenever a visitor enters our page a random feed will be displayed .
The complete script is available allthefeeds.php.txt . Right click and save as and then remove the .txt extension off the end.
Now we simply put the following code on the page we want the random feed to appear.
<?php
include ("allthefeeds.php");
?>
And here is our example , refresh your browser to change the news .
Warning: include(allthefeeds.php) [function.include]: failed to open stream: No such file or directory in /home/beginne/public_html/randomfeeds.php on line 189
Warning: include(allthefeeds.php) [function.include]: failed to open stream: No such file or directory in /home/beginne/public_html/randomfeeds.php on line 189
Warning: include() [function.include]: Failed opening 'allthefeeds.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/beginne/public_html/randomfeeds.php on line 189