Re: Reading from remote files
| From: | Richard Lynch | Date: | Tue, 31 Jul 2001 07:42:58 +0000 |
| Subject: | Re: Reading from remote files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60348@lists.php.net to get a copy of this message | ||
> I am trying to read in a nav bar from a remote web page into my web page.
> There is a comment at the start <!-- 1st Column start --> and one at the
end
> <!-- 1st Column end -->, and i want to be able to read in everything
between
> these two comments.
How sure are you that these comments won't change...?
<?php
$remote = file("http://whatever.com/navbar.htm") or
die("Could not snag
remote web page.");
$html = implode('', $remote);
$parts = explode('<!-- 1st Column start -->', $html);
$goodpart = $parts[1];
$parts = explode('<!-- 1st Column end -->', $goodpart);
$navbar = $parts[0];
echo $navbar;
?>
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm