check for bigger link
| From: | Martin Kampherbeek | Date: | Sat, 09 Mar 2002 12:39:14 +0000 |
| Subject: | check for bigger link | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87870@lists.php.net to get a copy of this message | ||
I made a script that looks in a URL for jpg's and their links.
So the result is:
s1.jpg links to b1.jpg
s2.jpg links to b2.jpg
etc etc
But now I would like to check if b1.jpg is bigger then s1.jpg, if not the script must stop. But I
can't figure out to do this.
My script so far:
<?
$fp=fopen('http://www.mydomain.com/test.htm','r');
$text=fread($fp,100000);
fclose($fp);
$preg='/
<a
[^>]*
href=
"?\'?
([^"\'>]*\.jpg)
[^>]*
>
([^<]|<(?!a))*
<img
[^>]*
src=
"?\'?
([^"\'>]*\.jpg)
[^>]*
>
([^<]|<(?!a))*
<\/a
/siUx';
preg_match_all($preg,$text,$matches);
for ($k=0;$k<count($matches[0]);$k++){
echo $matches[3][$k].' linkt naar '.$matches[1][$k].'<br>';
}
?>