Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. $css = file_get_contents('style.css');
  3. preg_match_all('~url\((.*?)\)~', $css, $matches);
  4. foreach ($matches[1] as $img) {
  5.         $img_path = str_replace('../graphic/', '', $img);
  6.         $whole_path = 'http://www.propertyauction.com/' . str_replace('../', '', $img);
  7.         $local_path = dirname(__FILE__) . '/css-imgs/' . $img_path;
  8.         if (!file_exists(dirname($local_path))) {
  9.                 mkdir(dirname($local_path));
  10.         }
  11.         echo $whole_path . ' --> ' . $local_path . "\n";
  12.         copy($whole_path, $local_path);
  13. }
  14. // print_r($matches);
  15. ?>