jfee1212 Posted May 9, 2006 Share Posted May 9, 2006 I am making a simple PHP proxy script to allow access to sites blocked by my school's firewall.I am trying to change all relative links to absolute links so they are consistant and easier to work with.I have this code... [code]$pattern = '#href[\s]*\=[\s]*(\'|"|)(\|/|)#i';$replace = 'href="'.$_POST['site']."/";$html = preg_replace($pattern, $replace, $html);}[/code]However when I open google with this done, the links are still relative.Any assistance in correcting and understanding the problem is greatly appreciated.TIA-Josh Quote Link to comment https://forums.phpfreaks.com/topic/9424-preg_replace-pattern-problems/ Share on other sites More sharing options...
jfee1212 Posted May 23, 2006 Author Share Posted May 23, 2006 bump... Quote Link to comment https://forums.phpfreaks.com/topic/9424-preg_replace-pattern-problems/#findComment-38208 Share on other sites More sharing options...
samshel Posted May 23, 2006 Share Posted May 23, 2006 [code]$pattern = '#href[\s]*\=[\s]*(\'|"|)(\|/|)#i';$replace = 'href=$1'.$_POST['site'].'/';$html = preg_replace($pattern, $replace, $html);} [/code] Quote Link to comment https://forums.phpfreaks.com/topic/9424-preg_replace-pattern-problems/#findComment-38214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.