Sitemeter works by inserting an image and iframe into your page, so that when the browser retrieves it, sitemeter can look at the referer and know what page was visited. But you can't include image links in an XML or GIF file, so I can't tell which of the bililite webservices are being visited. But behind the scenes, all the files are PHP files, so I can use cURL to get the image file as long as I can spoof the parameters so sitemeter thinks it knows where the request came from. A little experimentation came up with this:
function getSitemeterImage(){
// the sitemeter image parameters; obtained by inspection
$opts = array(
'site' => 's48bililite',
'refer' => urlencode ($_SERVER['HTTP_REFERER']),
'pg' => urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']),
'rnd' => rand()/getrandmax()
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://s48.sitemeter.com/meter.asp?'.http_build_query($opts));
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_REFERER']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// be nice to the server (http://inanimatt.com/php-curl.php)
curl_setopt($ch, CURLOPT_USERAGENT, 'Bililite Webservices (http://bililite.com/webservices)');
curl_exec($ch); // get the image to tell sitemeter that we were here
}
We don't actually use the image; all we want is to let sitemeter know that we want it.