replace ../ with actual url

From: Date: Thu, 27 Mar 2003 20:29:34 +0000
Subject: replace ../ with actual url
Groups: php.windows 
Request: Send a blank email to php-windows+get-19170@lists.php.net to get a copy of this message
Hi, I am currently writing a script that runs though a specified URL and translates any text and returns the translated website back to the user. In order for the website to be displayed correctly, the images should all be on display. However, images which are linked like so: src="../image_dir/image.jpg" are looked for on my server. I therefore decided to use: preg_replace(). I am now stuck on the regular expression. I thought an array would be best suited for this because I need to replace the following. $pattern[0] = "src="../"; $pattern[1] = "src=../"; $replace[0] = "src="$base_url/"; $replace[1] = "src="$base_url/"; I need the regular expressions! Any help and additional advice would be brilliant. Thanks, Kieran Hall

« previous php.windows (#19170) next »