Chromedata


#1

Has anybody ever worked with Chromedata for vehicle information? It is a WSDL web service, need to get pull certain information.


#2

Haven’t but interested in knowing about it. I have a mechanic client that could use it.

What’s the question?


#3

Chromedata is basically a web service that you enter a vehicle’s VIN and it provides data on the vehicle including engine type, fuel type, colors, displacement, basically all the information needed on a vehicle. I need to figure out a way to pull certain data from it using PHP. There is a way to turn that data into STDClass objects but the problem I’m having is that certain classes or arrays have the same name but with different data. For example, there is an array called styles and within in that it has all this information but certain information has the same object name like value or styleId. I’m having a hard time pulling only certain data that have the same array name or object name. I would post code if interested


#4

Code and an example of what you get back from the request will help.


#5

Ok so here is the php code

[php][embed=425,349]include( ‘Chromedata.php’ );

use TANIOS\ Chromedata\ Chromedata;
$chromedata = new Chromedata( array(
‘number’ => ‘308444’,
‘secret’ => ‘XXXXXXXX’,
‘country’ => ‘CA’,
‘language’ => ‘en’
) );
//Array ( [0] => 373048 [1] => 373054 [2] => 373061 [3] => 373063 [4] => 373069 ) CAC40FOT11AD0

$vin = “1FTFW1EG0FFC96115”;
//$vin = $_GET[‘var’];
$response = $chromedata->getCarInfoByVin( $vin );
//var_dump( $response );
print_r( $response );
$year = $response->vinDescription->modelYear; // This pulls the year of the vehicle
$make = $response->vinDescription->division; // this pulls the make of the vehicle
$model = $response->vinDescription->modelName; // this pulls the model type of vehicle

// This pulls the different style options of the vehicle //
$noStyles = 0;
foreach ( $response->style as $key => $object ) {
$noStyles = $key;
}
$style = array();

if ( $noStyles == 0 ) {
array_push( $style, $response->style->nameWoTrim );
} else {
foreach ( $response->style as $key => $object ) {
array_push( $style, $response->style[ $key ]->nameWoTrim );
}
}

// This pulls the different trim options of the vehicle //
$noTrims = 1;
foreach ( $response->style as $key => $object ) {
$noTrims = $key;
}
$trimall = array();

if ( $noTrims == 0 ) {
array_push( $trimall, $response->style->trim );
} else {
foreach ( $response->style as $key => $object ) {
array_push( $trimall, $response->style[ $key ]->trim );
}
}

// This pulls the different fuel type of the vehicle //
$noFuel = 0;
foreach ( $response->engine as $key => $object ) {
$noFuel = $key;
}
$fuelType = array();

if ( $noFuel == 0 ) {
array_push( $fuelType, $response->engine->fuelType->);
} else {
foreach ( $response->engine as $key => $object ) {
array_push( $fuelType, $response->engine[ $key ]->fuelType->
);
}
}

// This pulls the different engine size of the vehicle //
$noDisp = 0;
foreach ( $response->engine as $key => $object ) {
$noDisp = $key;
}
$disp = array();

if ( $noDisp == 0 ) {
array_push( $disp, $response->engine->);
} else {
foreach ( $response->engine as $key => $object ) {
array_push( $disp, $response->engine[ $key ]->displacement->value->
);
}
}

$manu = $response->vinDescription->WorldManufacturerIdentifier; // This pulls the the manufacturer of the vehicle //

$noFront = 0;
foreach ( $response->technicalSpecification as $key => $object ) {
$noFront = $key;
}
$front = array();
if ( $noFront == 0 ) {
array_push( $front, $response->technicalSpecification );
} else {
foreach ( $response->technicalSpecification as $key => $object ) {
array_push( $front, $response->technicalSpecification[ $key ]->value );
}
}

/*create car details array to pass back to decode.js */
$car = array(
‘year’ => $year,
‘make’ => $make,
‘model’ => $model,
‘style’ => $style,
‘trim’ => $trimall,
‘fuel’ => $fuelType,
‘displacement’ => $disp,
‘Manufactured By’ => $manu
//‘FrontTire’ => $front

);

echo json_encode( $car, JSON_PRETTY_PRINT );

?>[/embed]
This is the info that posts from the above
{ “year”: 2015, “make”: “Ford”, “model”: “F-150”, “style”: [ “4WD SuperCrew 157"”, “4WD SuperCrew 157"”, “4WD SuperCrew 157"”, “4WD SuperCrew 157"”, “4WD SuperCrew 157"” ], “trim”: [ “Platinum”, “Lariat”, “King Ranch”, “XLT”, “XL” ], “fuel”: [ “Gasoline Fuel”, “Flex Fuel Capability” ], “displacement”: [ “3.5”, “5.0” ], “Manufactured By”: "United States Ford " }[/php]


#6

Also the attached txt is all the data that prints out from the service. its a lot of information


cardata.txt (221 KB)


#7

Okay, the service gives back an array of objects. So, you need to decipher which object you are after, correct?


#8

Correct so as you can you in the sample code I’m already calling the Year, make, model, style, trim and manufactured by. I need to pull tire size and if possible wheel rim diameter, and width but the problem I’m having is that each of those objects have the same name for example they are listed as just value under technicalspecification array. If you see the attached txt file you can search for technicalspecifications and then search tire size or p275/R something for example the size of tire. I need to figure out how to just decipher that object without calling the rest of the objects that have the same name of value


#9

I see tires in the description, as poorly as the design translates, you may have to loop through everything returns and then send the object to a parser to parse that particular object


#10

Yea it is poorly design. I wish the company that created the webservice had a better solution. I figured that I might have to do something like that.