tags:

views:

50

answers:

2

hi,
Actually i am working on a web site and on that site i want to add two more features like,

  • Incoming google links:
  • Incoming yahoo links:

when user write his web site url in text box then the result show below the total incoming google and yahoo links.

If anyone has the knowledge of this, then please help, waiting,,thanks

A: 

You can use the $_SERVER['HTTP_REFERER']:

http://php.net/manual/en/reserved.variables.server.php

Kristopher Ives
A: 

You would have to use a database (like MySQL) to store the HTTP_REFERERs, like Kristopher Ives mentioned. But first you would have to analyze the referers to see whether it came from a yahoo or google domain.

$regex = '/(?:yahoo|google)\.[a-z]{2,3}$/';
$info = parse_url($_SERVER['HTTP_REFERER']);
if ($info !== false && preg_match($regex,$info['host']))
   // Add $_SERVER['HTTP_REFERER'] to database or increment a counter
   // on the matched domain
watain