views:

33

answers:

1

I need a code for take the link address that be in the email message body. Now i take message body in a variable and i can print that one on the screen. Now i need to take the link contained in it. Or otherwise need a code for converting that text file in t an html format . please help for doing this

+1  A: 

you should use regular expression and use this to replace those links in your content

$body = preg_replace('!((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)!', '<a href="$1">$1</a>', $body);

for reference the manual of preg_replace

RageZ
sir this one getting error.getting a warning "Warning: Unknown modifier 'f' in /e_drive/projects/testing/kiran/testaddon.php on line 76" and not getting the desired output
saif
sorry I have to edit
RageZ
Did you got any new idea. Still i can't find it
saif