preg replace - How to encode url by using preg_replace function in php? -


i have follow code:

$content = preg_replace('/<a href="http:\/\/domain.com\/view\/img\/(.*)">text<\/a>/', '<a href="http://mydomain.com/get.php?url='.base64_encode('{$1}').'">text</a>', $content); 

thanks much.

if using php, think have scape ". try with:

$content = preg_replace('/<a href=\"http:\/\/domain.com\/view\/img\/(.*)\">text<\/a>/', '<a href="http://mydomain.com/get.php?url='.base64_encode('{$1}').'">text</a>', $content); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -