Links extraction from a URL

  • dr nick
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Sep 10, 2003
  • Posts: 263
  • Loc: Frankfurt
  • Status: Offline

Post March 10th, 2004, 9:46 am

Hi,

I think there's a function in Perl that automatically extracts all links from a given url, but is there a similar type of function for PHP?

For instance, opening the contents of a url is easy with the fopen() function, but I thought there might be an automatic html parser to extract a list of links. Am I too hopeful?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 10th, 2004, 9:46 am

  • RichB
  • Guru
  • Guru
  • User avatar
  • Joined: May 17, 2003
  • Posts: 1121
  • Loc: Boston
  • Status: Offline

Post March 10th, 2004, 11:10 am

I don't know about a built-in function, but there is an example script at phpfreaks that extracts absolute links from an url. As it is currently written the links are printed and if you click on a link that url is processed and the links extracted. Perhaps you could use it as an example for making your own function.

http://www.phpfreaks.com/quickcode/Extr ... age/15.php
Free Programming Resources
  • dr nick
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Sep 10, 2003
  • Posts: 263
  • Loc: Frankfurt
  • Status: Offline

Post March 15th, 2004, 3:01 pm

Thanks RichB, that link was perfect, thanks a ton!

Still need to get my head around regular expressions, but it will come :D

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 265 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.