PHP grabbing links on websites?
Is it possible to have a php script go to a website and grab all it's links? What i want to do is have an automatic link checker. Where someone submits a link and the script verifys that they have a link pointing back to us.
Keith
CptAwesome posted this at 23:58 — 22nd January 2005.
He has: 370 posts
Joined: Dec 2004
Sort of.
You'd need to use 2 things:
file(); (of fread, or a couple other options) to pull all the information from the other page
and a preg, or ereg function to scan through the page for that information.
http://www.php.net/manual/en/function.file.php
http://www.php.net/manual/en/function.ereg.php
http://regexlib.com/
http://ca3.php.net/manual/en/function.preg-grep.php
http://www.perldoc.com/perl5.8.0/pod/perlretut.html
Those 6 links, if read well, should help a lot.
keith2045 posted this at 01:25 — 23rd January 2005.
They have: 27 posts
Joined: Oct 2001
Ok great, thanks. I will look over those soon.
Keith
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.