Reading a file and finding and opening the links in it.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sheikhmdirfan
Forum Newbie
Posts: 22
Joined: Tue Jan 20, 2009 12:21 am

Reading a file and finding and opening the links in it.

Post by sheikhmdirfan »

hi all,

I have a file containing links to other web pages.

While reading the file i want to be able to find out the hyperlinks from the rest of the text and open them as well.
php_ghost
Forum Commoner
Posts: 55
Joined: Thu Jan 11, 2007 3:29 am

Re: Reading a file and finding and opening the links in it.

Post by php_ghost »

I've done a script that does the same thing.

Use PHP's file function (or any other similar function that does the same thing) to read the contents of the file.
And I suggest you read on regular expressions in PHP to capture the links inside the file.
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Reading a file and finding and opening the links in it.

Post by papa »

You'll probably find a couple of good regexps on google if you like.
Post Reply