getting links from a web page

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
rats
Forum Newbie
Posts: 21
Joined: Fri May 31, 2002 5:55 am

getting links from a web page

Post by rats »

I am trying to get all the links from a web page.
anyone got a regular expression or other that will do it.
I am using this but it only gets about half the links

I also want to later sort through the links and get all the image links...
such as 01.jpg

any help is appreciated.

Code: Select all

$contents = Implode("", File($rowї'url']));
        
preg_match_all("/href="?(&#1111;^"' >]+)(.*)(<\/a>)/i", $contents, $arrayoflinks);
Post Reply