i'm working on a site right now that contains a 'headlines' section that needs to grab headlines from a couple other sites and display the links. rss isn't an option, so i would like to use a php script to read the remote sites and grab the headline info.
from the php manual, i was able to come up with:
[php]
<?
$file = fopen ("http://www.example.com/", "r");
while (!feof ($file))
{
$line = fgets ($file, 1024);
if (eregi ("<a href=\"articles/>(.*)</a>", $line, $out))
{
$link = $out[0];
break;
}
}
fclose($file);
?>
[/php]
this basically does what i need it to, except that the eregi will only find matches if the opening and closing tags are on the same line. one of the sites i'm trying to grab a link from uses multiple lines:
[php]
<a href="articles/headline.htm">
Headline
</a>
[/php]
anyone have any ideas about how i can get this to work???