[ciapug] Extract files used on a page

Darcy Baston ciapug@cialug.org
Wed, 23 Feb 2005 01:08:26 -0600


Cool! So glad to have helped.

I just recently wrote a php script that dynamicly creates an RSS feed 
from data in a MySQL database. I love PHP!

Darcy

jcbailey@code0.net wrote:

>Thanks! Just changed the A HREF in the example to IMG SRC. Works great for
>my use.
>
>
>Jon
>
>  
>
>>Ok. This page has code showing how to extract links from pages. It
>>checks their status, but you can change it to get file sizes instead.
>>
>>http://www.webreference.com/programming/php/cookbook/chap11/2/3.html
>>
>>This b it seems the most useful:
>>
>>|function pc_link_extractor($s) {|
>>|    $a = array();|
>>|    if (preg_match_all('/<A\s+.*?HREF=[\"\']?([^\"\'
>>    
>>
>>>]*)[\"\']?[^>]*>(.*?)<\/A>/i',|
>>>      
>>>
>>|                       $s,$matches,PREG_SET_ORDER)) {|
>>|        foreach($matches as $match) {|
>>|            array_push($a,array($match[1],$match[2]));|
>>|        }|
>>|    }|
>>|    return $a;|
>>|}
>>|
>>
>>Darcy
>>
>>
>>jcbailey@code0.net wrote:
>>
>>    
>>
>>>I already have a function to get the file size. I need something that
>>>will
>>>parse HTML and get all the files its linking to (CSS,JS,images, etc).
>>>
>>>
>>>Jon
>>>
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>
>_______________________________________________
>ciapug mailing list
>ciapug@cialug.org
>http://cialug.org/mailman/listinfo/ciapug
>
>  
>