public marks

PUBLIC MARKS from imelgrat with tags "Sample Code" & "converter text"

17 July 2007 16:30

Convert a Webpage to Plain Text

This function takes a URL and returns a plain-text version of the page. It uses cURL to retrieve the page and a combination of regular expressions to strip all unwanted whitespace. This function will even strip the text from STYLE and SCRIPT tags, which are ignored by PHP functions such as strip_tags (they strip only the tags, leaving the text in the middle intact).