filesize problem

From: Date: Thu, 14 Mar 2002 21:34:14 +0000
Subject: filesize problem
Groups: php.general 
Request: Send a blank email to php-general+get-88576@lists.php.net to get a copy of this message
Hi, I talked to you on ICQ and told you to send an email with my PHP problem. So here it is. Someone is submitting an URL. The problem is that someone is submitting the URL per form. So it is allways something like http:\\www.mydomain.com\1.htm In that case it is difficult to tell where to look, because the submitted URL is ending with htm. I would like to know the filesizes of the jpg's in the URL, so I'm talking about matches 1 en 3. This is the script I got so far: <? $fp=fopen('http://www.mydomain.com/1.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].' links to '.$matches[1][$k].'<br>'; } ?>

« previous php.general (#88576) next »