Get URL backlinks
I am trying to create a script to get the amount of backlinks to particular URLs - the method I am currently using is to query the google search API for link:example.com/foo/bar
which returned the amount of results - I used that value 开发者_如何学Goto estimate the backlinks.
However, I am looking for alternate solutions.
The most basic approach would be to log $_SERVER['HTTP_REFERER']
on every incoming request, which is the URL of the site linking to your site. I'm sure there are some caveats to this approach (i.e. conditions under which Referer is not sent, potential for being spammed through bogus Referer URLs), but I can't speak to all of them. The Wikipedia page may be a good starting point.
There are also pingbacks/trackbacks, but I wouldn't rely on them.
Pingbacks / Trackbacks are to determine hits from a particular website. These are manual, rather than automatic, and are meaningful when there is a HIT from them.
However, the approach you did till now, is something that involves a huge cache of links and backlinks.
Either there must be some kind of database to track the nodes of connection between two pages, or you must start builiding your own.
Use the available ones, and better build a mashup of more than one database. But, if you want to have strong system built, then verify the backlink from your system, and then maintain the cache at your end too. The cache should include the verified backlinks only.
I hope this works.
I think http://www.opensiteexplorer.org/ and their api might be of more help.
精彩评论