Skip to content

Instantly share code, notes, and snippets.

@pullmonkey
Created November 16, 2010 03:40
Show Gist options
  • Save pullmonkey/701379 to your computer and use it in GitHub Desktop.
Save pullmonkey/701379 to your computer and use it in GitHub Desktop.
Way to use the Skizmo VINAPI in PHP
<?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;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment