Hi I need some help to get this done using php: 1 - I have few hyperlinks say 500 in format like: <a href="http://domaina.com/1.html" target="_blank">http://domaina.com/1.html</a> <a href="http://domainb.com/1.html" target="_blank">http://domainb.com/1.html</a> <a href="http://domainc.com/21.html" target="_blank">http://domainc.com/21.html</a> <a href="http://domaind.com/new.php" target="_blank">http://domaind.com/new.php</a> etc etc Now I want to convert them into format like: <a href="http://domaina.com/1.html" target="_blank">keyword 1</a> <a href="http://domainb.com/1.html" target="_blank">keyword 2</a> <a href="http://domainc.com/21.html" target="_blank">keyword 3</a> <a href="http://domaind.com/new.php" target="_blank">keyword 4</a> Here keyword 1,2,3,4 can be taken randomly from a file which has huge list of keywords or may be we can paste the hyperlinks and keywords in php form itself and then it just links into the manner as given above. Can anyone provide the code for doing this? Thanks
following is a quick fix solution.. there could be better one as well.. <?php echo replace_anchor_text('<a href="http://domaina.com/1.html" target="_blank">http://domaina.com/1.html</a>', 'keyword 1'); function replace_anchor_text($text, $replace) { return preg_replace('#[>](.*?)</#', '>' . $replace . '</', $text); } ?> PHP: