php - convert internal links to remote website -


I get a website html data. And I have to change all the links on the remote website. Like I have a link & lt; A href = "/ search?" > I & lt; A href = "http://google.com/search?" & Gt;

Maybe you can be away from just a simple:

  & lt; Top & gt; & Lt; Base href = "http://google.com/" / & gt; & Lt; / Head & gt;  

Otherwise, you can make some simple mails and replace:

   < / Pre> 

Two large ones are src and href . You may need double quotes and single quotes.

If you ( Most) Want to make sure that only matches within the tags and only the relative URL, you will need to use regular expressions (and I'm sure someone will give you some examples).


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -