
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.51 KB | hits: 18 | expires: Never
<?php
$css = file_get_contents('style.css');
preg_match_all('~url\((.*?)\)~', $css, $matches);
foreach ($matches[1] as $img) {
$img_path = str_replace('../graphic/', '', $img);
$whole_path = 'http://www.propertyauction.com/' . str_replace('../', '', $img);
$local_path = dirname(__FILE__) . '/css-imgs/' . $img_path;
if (!file_exists(dirname($local_path))) {
mkdir(dirname($local_path));
}
echo $whole_path . ' --> ' . $local_path . "\n";
copy($whole_path, $local_path);
}
// print_r($matches);
?>