PHP Classes

Example Code for Handling URLs

Recommend this page to a friend!

      RTF Generator  >  All threads  >  Example Code for Handling URLs  >  (Un) Subscribe thread alerts  
Subject:Example Code for Handling URLs
Summary:Details how to convert URLs to be nice in RTF formats
Author:Chris Winfield-Blum
Date:2008-01-08 01:04:09

  1. Example Code for Handling URLs   Reply   Report abuse  
Picture of Chris Winfield-Blum Chris Winfield-Blum - 2008-01-08 01:04:10
The following outlines how to find all URL links (email or www)
At this stage all it does is 1 find URL (email or www) and then replaces them with plain text.

enter the following into the file with all the other preg_replaces

$doc_buffer = preg_replace("/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/i", "\\3 [ \\1 ]", $doc_buffer);

See how that goes. I am also working on converting the URL into a RTF Hyperlink but ill get to that later