Filesize problem PHP problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The Tweet
    Registered User
    • Jan 2002
    • 52

    #1

    Filesize problem PHP problem

    Hi,

    Can someone help me with this problem?

    Someone is submitting an URL.
    The problem is that someone is submitting the URL per form. So it is allways something like http://www7.kinghost.com/amateur/the...mature/7/7.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 wrote so far:

    <?
    $fp=fopen('http://www7.kinghost.com/amateur/thetweet/mature/7/7.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>';
    }
    ?>
  • The Tweet
    Registered User
    • Jan 2002
    • 52

    #2

    Comment

    Working...