Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Created April 3, 2013 01:29
Show Gist options
  • Save sirkirby/5297732 to your computer and use it in GitHub Desktop.
Save sirkirby/5297732 to your computer and use it in GitHub Desktop.
<?php
$creds = "username:password";
$headers = array("Accept: application/json");
// build the curl request
$request = curl_init();
curl_setopt($request, CURLOPT_URL, "http://vinexplosion.com/api/vin/decode/3GYFNAE36CS509361/?fuzzy=true");
curl_setopt($request, CURLOPT_USERPWD, $creds);
curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
// exe the request and gather the code and response
$response = curl_exec($request);
$code = curl_getinfo($request, CURLINFO_HTTP_CODE);
curl_close($request);
// process the json response
$rvef = json_decode($response);
$provider = $rvef->Vehicles[0]->Providers[0];
$year = $provider->Year;
$make = $provider->Make;
$model = $provider->Model;
// output the model
print($year." ".$make." ".$model);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment