rusty.nells
New Member
- Reaction score
- 0
- Location
- Republic Of Texas
Anybody sell or advertise on craigslist?
Here's a little php script I put together to see how many page views my posts get. Whenever someone views my post, I get an email. The email is filtered and sent to it's own folder where I can easily get a count. You could also mod this to save data in a database or display an actual counter in the post.
This requires a web server with php and sendmail() enabled.
First, copy the following code and save as "view.php"
You might want to change the $email variable. You'll definitely need to change the $recipient variable, enter your own email address. Save and upload to your web server.
Then (assuming you uploaded to the root directory) insert the following code in to your craigslist post. Edit MYWEBSITE.COM and YOUR_ITEM_NAME
This should work on other sites that allow the IMG tag.
Here's a little php script I put together to see how many page views my posts get. Whenever someone views my post, I get an email. The email is filtered and sent to it's own folder where I can easily get a count. You could also mod this to save data in a database or display an actual counter in the post.
This requires a web server with php and sendmail() enabled.
First, copy the following code and save as "view.php"
PHP:
<?
if(isset($_GET['item']))
{
$ua = $_SERVER['HTTP_USER_AGENT'];
$ref = $_SERVER['HTTP_REFERER'];
$viewer = $_SERVER['REMOTE_ADDR'];
$item = $_GET['item'];
$Name = "Viewer";
$email = "myaddress@mydomain.com";
$recipient = "myaddress@mydomain.com"; //enter your own email address
$mail_body = "IP address is $viewer\n
Referrer is $ref\n\n
User Agent is $ua\n\n
More IP info - http://www.ip-adress.com/ip_tracer/?QRY=$viewer";
$subject = "$item Viewed by $viewer";
$header = "From: ". $Name . " <" . $email . ">\r\n";
mail($recipient, $subject, $mail_body, $header);
header("Location: index.php");
}
else
header("Location: index.php");
?>
You might want to change the $email variable. You'll definitely need to change the $recipient variable, enter your own email address. Save and upload to your web server.
Then (assuming you uploaded to the root directory) insert the following code in to your craigslist post. Edit MYWEBSITE.COM and YOUR_ITEM_NAME
HTML:
<img src=http://MYWEBSITE.COM/view.php?item=YOUR_ITEM_NAME width=0 height=0>
This should work on other sites that allow the IMG tag.