EDIT May 4 2010: THE FORMAT OF CAMAROTRACKING.COM HAS CHANGED AND THIS CODE NO LONGER FUNCTIONS PROPERLY
So, I was really bored, and of course the thought of my new truck is all I can think about... I generated this little PHP script that web-scrapes camarotracking.com and gives you some basic textual information on your vehicle. I figured I would post it here in case anyone was interested.
Enjoy
So, I was really bored, and of course the thought of my new truck is all I can think about... I generated this little PHP script that web-scrapes camarotracking.com and gives you some basic textual information on your vehicle. I figured I would post it here in case anyone was interested.
Enjoy
Code:
<?php
$sourceUrl="[url]http://www.camarotracking.com/?track=YOUREMAILADDRESS";[/url]
$source_code = file_get_contents($sourceUrl);
$spot=strpos($source_code,"<div class=\"yourcar\">");
if ($spot){
$spot2= strlen($source_code)-$spot;
$source_code=substr($source_code, -1*$spot2);
}
$spot=strpos($source_code,"</div");
$spot=strpos($source_code,"</div",$spot+2)+6;
$source_code=substr($source_code,0, $spot);
$spot=strpos($source_code,"<form");
$spot2=strpos($source_code,"</form")+7;
$x=strlen($source_code)-$spot2;
$source_code=substr($source_code,0,$spot).substr($source_code,$x*-1);
$source_code=str_replace("<img src=\"templates/assets/your_car.png\" align=\"left\">","",$source_code);
$t=array();
$v=array();
$spot=strpos($source_code,"<b>");
while ($spot){
$spot+=3;
$source_code=substr($source_code,$spot);
$spot=strpos($source_code,"</b>");
$t[]=str_replace(":","",substr($source_code,0,$spot));
$source_code=substr($source_code,$spot+4);
$spot=strpos($source_code,"<span>")+6;
$source_code=substr($source_code,$spot);
$spot=strpos($source_code,"</span>");
$v[]=substr($source_code,0,$spot);
$source_code=substr($source_code,$spot+4);
$spot=strpos($source_code,"<b>");
}
for ($i=0; $i<count($v); $i++){
echo "<b>$t[$i]</b>: $v[$i]<br />";
}
function toHtml($v){
return str_replace(">",">",str_replace("<","<",$v));
}
?>