Created
April 3, 2013 01:29
-
-
Save sirkirby/5297732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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