Re: Source Code for the CNN Grabber
| From: | Ron | Date: | Thu, 28 Mar 2002 15:41:26 +0000 |
| Subject: | Re: Source Code for the CNN Grabber | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90538@lists.php.net to get a copy of this message | ||
Sorry meant to reply to my previous post........All it does is return a
blank page!
"Ron" <allenr@fwd.areur.army.mil> wrote in message
news:20020328152931.74010.qmail@pb1.pair.com...
> This is the source, which is to advanced for me to debug!!!
> Waiting on their responce and maybe they can help me.....Anybody have any
> clues
>
> <?
> #--------------------------------#
> # spider_cnn.php
> #
> # Copyright W3matter.com LLC
> # http://www.w3matter.com
> #--------------------------------#
> # Released under the GNU
> # Please keep this copyright
> # notice intact.
> #--------------------------------#
>
>
> #- Spider CNN for latest headlines
>
> #- Fetch the page and remove newlines
> $page =
> @join("",file("http://www.cnn.com/"));
> $page = str_replace("\n","",$page);
>
> #- Grab the latest news segment from the page
> if(preg_match("/OTHER TOP NEWS(.*?)\/other news/",$page,$match))
> {
> #- Grep each headline and it's URL
> if(preg_match_all('/<a
> href="(.*?)">(.*?)<\/a>/',$match[1],$matches))
> {
> $out = "<h3>Today's CNN Headlines</h3>";
> $out .= "<font size=-1>\n";
> $out .= "<ul>\n";
>
> $num = count($matches[1]);
> for($x=0;$x<$num;$x++)
> {
> $url = "http://www.cnn.com".$matches[1][$x];
> $title = $matches[2][$x];
> $out .= "<li> <a href=$url target=blank>$title</a>\n";
> }
>
> $out .= "</ul>\n";
> $out .= "</font>\n";
>
> echo $out;
>
> }
> }
>
> ?>
>
>
>
>