| 8,798 URLs Rotating | 2,235,131 Hits This Month | 4,201 Members |
Traffic Exchange Toolbox
Exchange Owner Information
List Rotator URLs
If your software cannot read TERP headers, you can use the form below to grab a list of URLs a rotator is rotating. Simply copy and paste the rotator URL and it will return the URLs for you. Please note that we will try to keep rotators clean, but due to the nature of the internet we cannot guarantee this.
TERP Compatable
Our rotators are TERP Compatable. TERP (Traffic Exchange Redirect Protocol) allows your traffic exchange software to read the URLs from the rotator.The following code (PHP) will read the TERP header and return the rotator list url. Your software simply needs to then grab the list from that url.
<?
function getListURL($url) {
## Returns -1 if no TERP-List header found
## Returns -2 if error retrieving page
$url = str_replace("http://","",$url);
$listurl = -1;
if (strstr($url, '/')) {
$base = substr($url, 0, strpos($url,'/'));
$page = substr($url, strpos($url,'/'));
} else {
$base = $url;
$page = "/";
}
$fp = @fsockopen($base, 80, $errno, $errstr, 30);
if (!$fp) {
$listurl = -2;
} else {
$out = "GET $page HTTP/1.1\r\n";
$out .= "Host: $base\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$line = fgets($fp, 128);
if (strstr($line, "TERP-List")) {
$listurl = trim(str_replace("TERP-List: ","",$line));
break;
}
}
fclose($fp);
}
return $listurl;
}
?>
Traffic Exchange Redirect Protocol (TERP)
The below code is an example of how you would implement TERP on your own rotator or tracking service. Basically the concept is simple, the TERP header gives the URL to a plain text file that has each url in the rotator on a single line.
Code for rotator tracker:
Header("TERP-List: http://www.site.com/list.php?username=$username");
Code for list page:
$query = "SELECT * FROM `websites` WHERE `username`='$username'";
$result = mysql_query($query, $global_dbh);
$cnt = mysql_num_rows($result);
for ($i=0; $i<$cnt; $i++) {
$row = mysql_fetch_array($result);
$urls[] = $row["url"];
}
$urls[] = "http://www.mysite.com/index.php?referer=$username";
echo implode("\n", $urls);
exit();
