For my HTML Emailing purpose, I need to convert all relative path (href, src) needs to covert into absolute path. For example, there is an image in html page like <img src='images/edit.png' > of the host http://www.abc.com. I need to covert it into <img src='http://www.abc.com/images/edit.png' >. Any php script or your help is much appreciated.
Try something like this this: $self = $_SERVER['PHP_SELF']; $base_path = "http://".$_SERVER['HTTP_HOST']. $self; $full_path = $base_path . '/' . $rel_path; That may not be exactly what you want, but it should be close
Hi Actually I want to replace all href and src at a time. That means I want bulk replace and images location may in different relative path. $file=file_get_contents("http:/abc.com"); Now I want to replace all href and src by absolute path if they are in relative path. Thanks