Web Hosting Talk







View Full Version : Obtain domain name of site my ads were clicked from, using iframe


latheesan
10-12-2005, 06:25 AM
Here's the scenario...

I show my ads using a php file called 468x60.php file for e.g.

Then on one of my client's site, i ask them to put my ads using iframe like this

<iframe src="http://mysite.com/ads/468x60.php" scrolling="no"
frameborder="no" width="468" height="60"></iframe>

So, lets say i have about 50 clients with my ads on their site. How can i track down, which client's site (domain name) the ads were clicked from?

anjanesh
10-12-2005, 07:12 AM
You can check using $_SERVER['HTTP_REFERER'] (http://php.net/reserved.variables)- but this may not work in all browsers. Best option is to have the url sent with some parameter - the ad they click on will goto mydomain.com?clientid=45 - when they goto mydomain.com, get the clientid and store it. Also double check with $_SERVER['HTTP_REFERER'].

latheesan
10-12-2005, 10:55 AM
why wont $_SERVER['HTTP_REFERER'] work with some browsers? what are those browsers?

also

is there a way to use escaping url of a iframe or something?

anjanesh
10-12-2005, 11:07 AM
$_SERVER['HTTP_REFERER'] is something that the browser sends - its actually a piece of information sent by the client side to the server - so its not something that the server is setting - so this is not dependable.

For example, using can CURL (or sockets) you can load a page from the net - say yahoo.com - by sending some headers to yahoo.com - this header we can manipulate in anyway - including sending the wrong header for http_referer - say msn.com - so if yahoo.com's default page has a piece of code that stores every http_referer, then it'll store this particular one as msn.com - when it was actually coming from elsewhere.