Links extraction from a URL

  • dr nick
  • Proficient
  • Proficient
  • dr nick
  • Posts: 263
  • Loc: Frankfurt

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

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
  • dr nick
  • Proficient
  • Proficient
  • dr nick
  • Posts: 263
  • Loc: Frankfurt

Post 3+ Months Ago

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 124 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.