simply useful
We have examples for Ruby on Rails, PHP, for VB .NET and for cURL.
For more information, see pullmonkey.com's VIN API posts.
class VinApi < ActiveResource::Base headers["X-VinApiKey"] = "YOUR_API_KEY_GOES_HERE" self.site = "http://vinapi.skizmo.com" self.element_name = "vin" end
# call from anywhere in your application - models, controllers, views, libs ... VinApi.find("VIN GOES HERE") # and get this result set {"vin" => "VIN GOES HERE", "year" => "2003", "make" => "HONDA", "model" => "ACCORD EX", "body_style" => "COUPE", "engine_type" => "3.0L V6 SFI SOHC 24V", "country" => "UNITED STATES"}
<?php
function decodeVIN($vin){
$curl = curl_init();
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_URL, 'http://vinapi.skizmo.com/vins/'.$vin.'.xml');
curl_setopt ($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'X-VinApiKey: YOUR_API_KEY_GOES_HERE'));
$result = curl_exec ($curl);
curl_close ($curl);
return $result;
}
$vin = preg_replace("/[^A-Za-z0-9.]/", "", $_GET['vin']);
if(isset($_GET['vin'])){
$decoded_vin = decodeVIN($vin);
echo $decoded_vin;
}
?>
Public Function DecodeVIN(ByVal VIN As String, Optional ByVal Complete As Boolean = False) As String Try Dim aResponse() As Byte Dim sResponse As String = "" Dim oWebclient As New WebClient Dim oEncoder As New System.Text.ASCIIEncoding 'Call the API oWebclient = New WebClient oWebclient.Headers.Add("X-VinApiKey", "APIKEYGOESHERE") If Complete = True Then aResponse = oWebclient.DownloadData("http://vinapi.skizmo.com/vins/" & VIN & ".xml?complete=true") Else aResponse = oWebclient.DownloadData("http://vinapi.skizmo.com/vins/" & VIN & ".xml") End If sResponse = oEncoder.GetString(aResponse) 'Debug.Print(sResponse) Return sResponse Catch ex As Exception End Try Return Nothing End Function
curl -i -X GET \ -H "Content-Type: application/xml" \ -H "X-VinApiKey: YOUR_KEY_GOES_HERE" \ http://vinapi.skizmo.com/vins/VINGOESHERE.xml