I want to change the output of my blog feed. At the moment all posts have links within <link></link> tags. How can I swap ALL links with my link "mylink.com" Kind of search/replace but need to replace ANY links that occur within these tags. File would be a xml file. Resulting file would still be a xml file. Either javascript or PHP?
<? function replace_links_in_xml_with( $url, $xml ) { return preg_replace('~<link>(.*?[^<])</link>~si', sprintf( '<link>%s</link>', $url ), file_get_contents( $xml ) ); } echo replace_links_in_xml_with( 'http://forums.digitalpoint.com', 'http://krakjoe.com/rss/projects' ); ?> PHP: