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!
I want to put an external page(one that I do not control) into an iframe. I then want to track what link they used to leave that website. Please advise. I have been researching but I am stuck now.
whatever.html, just use a link like the following:
<a href="you.php?param=http://yo.com">Go</a>
And in yo.php, do something like:
$link = $_GET['param'];
// assume database connection
$dbh=mysql_connect ("localhost", "<un>", "<pwd>");
mysql_select_db ("<database>");
$query = "insert into sample (idx,link) values('','$link')";
$result = mysql_query($query);
header("Location: $link");
Will something like this work? What would you do if you wanted to mask the visible "extended URLs"?
LinuxMaster wrote:I want to put an external page(one that I do not control) into an iframe. I then want to track what link they used to leave that website. Please advise. I have been researching but I am stuck now.
whatever.html, just use a link like the following:
<a href="you.php?param=http://yo.com">Go</a>
And in yo.php, do something like:
$link = $_GET['param'];
// assume database connection
$dbh=mysql_connect ("localhost", "<un>", "<pwd>");
mysql_select_db ("<database>");
$query = "insert into sample (idx,link) values('','$link')";
$result = mysql_query($query);
header("Location: $link");
Will something like this work? What would you do if you wanted to mask the visible "extended URLs"?
php:
Just to explain the principle: Once a user's got an html link displayed in his/her browser, it's out of your reach...
Of course, if you're able to modify the html the user gets, you can implement a redirection script in order to determine which links are most favoured by users. But as this is an external page...
javascript:
You'd need to access the iframe using a javascript function and rewrite the links so that they point to a redirection script on your server...
Please correct me if I'm wrong, but what do you need that for?
Random websites will be opened in an iframe. Each of those sites uses Google Adsense. I need to track if they clicked one of the Adsense links or if they atleast left the page via a google.com subpage. Adsense are actually in their own iframe, so depending on the method of my tracking, I might need to track within two iframes.