I am trying to make a script that reads urls from a text file.
The first line of the text file will contain the text that should be displayed on the webpage. The second line of the file will contain the actual link to the website. I have include the script so far. Thanks for the help.
Text File
First web page
www.firstpage.com
Second page
www.secondlink.com
VB Code:
<?php function ConvertToLinks ($vert) { $vert = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2">\\2</a>', $vert); return $vert; } #*************************************** #Program start # # #*************************************** $filename = "text.txt"; $flepointer = fopen ($filename, "r") or die ("Could not open the file"); $contents = fread ($flepointer, filesize ($filename)); fclose($flepointer); echo ConvertToLinks($contents); ?>




Reply With Quote