Checking links in 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
amlan_08
Forum Newbie
Posts: 11
Joined: Sun May 22, 2005 1:24 am

Checking links in a web page

Post by amlan_08 »

Hello I am a new member of this forum.
I want to check whether the link of my homepage (ex. http://www.xyz.com) is present in any particular site or not. Is there any way to check that? 8O
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

You can use the web tester in SimpleTest to verify links, if that's what you mean?
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

it seems that amlan_08 wanted to find out who hotlinks his/her site - or posts his/her links on other site.
traherom
Forum Newbie
Posts: 13
Joined: Tue Mar 15, 2005 6:43 am

Google

Post by traherom »

I'd think the only way to do it is to donwload the whole code of the site, then just do a search for "www.xyz.com" or whatever. If you're making it a robot type thing, then you could have it follow all the links it could finds on the page (use a regex like:

Code: Select all

preg_match('/([a-z]{3,5}://|)((?:[a-z])*\.)/i', $sourceCode, $matches)
. That will only match URLs without paths after them (http://www.google.com, not http://www.google.com/ig), but you get the idea.) If you do it this way, be sure to follow the rules in robots.txt. Do a Google search to learn more.

Although that would work, you could just use Google. If you use 'link:www.xyz.com' in your google search, it will show you all the sites it has indexed which link to hte specified URL.
Post Reply