Forum Moderators: coopster

Message Too Old, No Replies

Need to extract URL from file

newbie needs help

         

cochranrg

4:03 pm on Aug 11, 2006 (gmt 0)

10+ Year Member



I am trying to write a recipricol link checker for my website. Am having a hard time figuring out how to pull URL's out of a file. I can get the webpage I need to check, search through it etc. But need to pull URL's so that I can do recursive checks on sub pages.

Any ideas?

Using Preg_split I can split the file by '/http:\/\//i' to get to the links, but cannot figure out how to strip everything after the end of the URL and keep the link.

Thanks in advance,
RC

wsmeyer

6:13 pm on Aug 11, 2006 (gmt 0)

10+ Year Member



I think you would do better using preg_match_all, this will return an array of all matches. For the match you have the start correct but have it stop at a "/" as an example this ([^/]) grabs everything that is not a "/". You might also want it to stop at a "?" to strip off GET variables.

William.