Posted by petersprc on 10/19/06 22:48
You may be able to use a simple regular expression. For example:
$html = file_get_contents('http://www.yahoo.com') or
trigger_error('file_get_contents');
if (preg_match('/\bimage.gif\b/', $html)) {
// Found image.gif
}
For a stricter match you could use a pattern like:
#<\s*img\s+([^>]*\s+)?src=(["\'](([^>=]+)?[/\\\\])?)?image\.gif(["\'\s].*?)?>#si
You can do more with regular expressions, or you could parse the HTML
with the PEAR module XML_HTMLSax3:
http://pear.php.net/package/XML_HTMLSax3
cainwebdesign@gmail.com wrote:
> I am trying to check to external web pages for values on the sites. I
> am totally new to php and i am using the strip tags to check if the
> value is there and that works for the one site but on the other site i
> need to check if a gif file is present. Can anyone help?
[Back to original message]
|