02-02-2009, 11:58 PM
|
#6 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I can't actually test this script I've just written because my web-server is currently broken, but hopefully it will give you an idea how to go about it  If you require any help what-so-ever though, do just ask the community!
php Code:
function getElementsByExtension (array $aExtensions){ $szContent = file_get_contents('http://www.talkphp.com/show-off/3929-zipthings.html'); $aElements = array(); foreach ($aExtensions as $szExtension) { preg_match_all('~(?:src|href)="([^"]+\.' . $szExtension . ')"~is', $szContent, $aMatches); $aElements[] = $aMatches[ 1]; } $pArray = (object ) array('aFlat' => array()); array_walk_recursive ($aElements, create_function('&$v, $k, &$t', '$t->aFlat[] = $v;'), $pArray); return $pArray-> aFlat; }print_r(getElementsByExtension (array('jpg', 'gif', 'css')));
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|