I need help please

I need to query a server using a prewriten script using the Get or Post parameter but I can’t get the form to place the required information (The vin) in the prewriten script please help I am new to Php

The follow was what I was given to code against please help I am a beginer with php

  1. Query a VIN

To query whether data for a VIN exists, request:

https://api.vinaudit.com/query.php
With GET or POST parameters:

vin: The vehicle identification number
key: Your VinAudit.com API key
format: Output format (either json or xml)
skipspec: Set “1″ if vehicle specs aren’t needed (optional)
mode: Set to “test” for development (optional)
callback: Javascript callback method (optional)
Response attributes:

id: The report ID to use in future requests
vin: The vehicle identification number
attributes: A map of specifications about the VIN (Make, Model, Style, Engine, Made In, Type)
success: Whether records exist in NMVTIS
error: One of no_records (no NMVTIS records exists), invalid_vin (not a valid VIN), fail_nmvtis (failed to reach NMVTIS), fail_spec (failed to retrieve specifications), or blank if no error
Example (json)
https://api.vinaudit.com/query.php?vin=1VXBR12EXCP901213&key=YOUR_KEY&format=json

{“id”:”7742103371467″, “vin”:”1VXBR12EXCP901213″,”attributes”:{“VIN”:”1VXBR12EXCP901213″,”Make”:”TOYOTA”,”Model”:”COROLLA CE”,”Style”:”4 DOOR SEDAN”,”Engine”:”1.8L L4 DOHC 16V”,”Made In”:”JAPAN”,”Type”:”PASSENGER CAR”},”success”:true,”error”:”"}
Implementation Notes:
Requests to the “query” API do not deduct from report credits.

  1. Retrieve a full NMVTIS Vehicle History Report

To retrieve the NMVTIS data for a VIN (if such data exists), request:

https://api.vinaudit.com/pullreport.php
With GET or POST parameters:

id: A unique report ID for this report request
vin: The vehicle identification number
user: Your VinAudit.com account username
pass: Your VinAudit.com account password*
key: Your VinAudit.com API key
format: Output format (either json or xml)
mode: Set to “test” for development (optional)
pdf: Set to “1″ to download a PDF (optional)
brand: Set to “0″ to produce unbranded PDF; requires pdf=”1″ (optional)
callback: Javascript callback method (optional)
Response attributes (if successful):

id: The report identifier
vin: The vehicle identification number
specs: A dynamic map of available vehicle specifications
jsi: An list of Junk/Salvage/Insurance records, each with attributes:
date: The brand date.
recordType: The type of record.
branderName: The brander’s name.
branderCity: The brander’s city.
branderState: The brander’s state.
branderEmail: The brander’s email.
branderPhone: The brander’s phone.
vehicleDisposition: The vehicle’s reported disposition.
intendedForExport: Whether the vehicle is intended for export.
checks: An list of brand records with the format:
date: The title brand date.
brandCode: The brand code
branderType: The brander’s type
branderName: The brander’s name
disposition: The vehicle’s reported disposition
titles: An list of title records with the format:
date: The title record date
state: The 2-letter code for the issuing state
vin: The recorded VIN (may be old VIN)
meter: The odometer reading
meterUnit: ‘M’ for miles, ‘K’ for kilometers
current: Whether the title record is current, not historical
success: Whether the report has been generated
error: blank if no error (see below for possibilities)
Response attributes (if failure):

vin: The vehicle identification number
success: Whether the report has been generated
details: State information for debugging purposes
error: One of…
invalid_vin (not a valid VIN)
fail_nmvtis (failed to reach NMVTIS)
no_records (no NMVTIS records exists)
not_ready (retry)
vin_mismatch (ID is associated with a different VIN; use new ID)
failed (unexpected error)
expired (report no longer cached)
blank if no error
Example #1 (no records, xml):
http://api.vinaudit.com/pullreport.php?id=00000000000001&key=0V9CRCA32QARIIE&vin=4JGBB86E78A330935&mode=&user=vatest&pass=vatest222&format=xml

4JGBB86E78A330935 515237647496 4JGBB86E78A330935 0 no_records Example #2 (full report data, json): http://api.vinaudit.com/pullreport.php?id=00000000000002&key=MY_KEY&vin=1VXBR12EXCP901213&mode=test&user=MY_USER&pass=MY_PASS&format=json

{“success”:true,”error”:”",”id”:”31919508431″,”vin”:”1VXBR12EXCP901213″,”date”:”2011-12-21 21:12:15 PST”,”specs”:{“Vin”:”1VXBR12EXCP901213″,”Year”:”2005″,”Make”:”Toyota”,”Model”:”Corolla”,”Trim”:”CE”,”Engine”:”1.8L L4 DOHC 16V”,”Style”:”SEDAN 4-DR”,”Made In”:”UNITED STATES”,”Steering Type”:”R&P”,”Anti-Brake System”:”4-Wheel ABS”,”Tank Size”:”13.20 gallon”,”Overall Height”:”58.50 in.”,”Overall Length”:”178.30 in.”,”Overall Width”:”66.90 in.”,”Standard Seating”:”5″,”Optional Seating”:”No data”,”Highway Mileage”:”38 – 41 miles/gallon”,”City Mileage”:”30 – 32 miles/gallon”},”jsi”:[{‘date’: ‘10/25/2007’,‘recordType’:‘Junk And Salvage’,‘branderName’:‘Insurance Salvage, Inc.’,‘branderCity’:‘Milwalkee’,‘branderState’:‘WI’,‘branderEmail’:’’,‘branderPhone’: ‘5556478921’,‘vehicleDisposition’:‘Sold’,‘intendedForExport’:‘No’}],”checks”:[ {‘brandCode’: ‘11’, ‘branderType’: ‘State’, ‘branderName’: ‘Ohio’, ‘disposition’: ‘Salvage’, ‘date’: ‘08/02/2005’ }, {‘brandCode’: ‘09’, ‘branderType’: ‘State’, ‘branderCode’: ‘’, ‘branderName’: ‘Ohio’, ‘disposition’: ‘Rebuilt’, ‘date’: ‘08/19/2005’ } ],”titles”: [ {‘de’: ‘08/31/2011’, ‘state’:‘WA’, ‘vin’:’’, ‘meter’:‘59,396’, ‘meterUnit’:‘M’, ‘current’: true}, {‘date’: ‘02/23/2008’, ‘state’:‘WI’, ‘vin’:‘1VXBR12EXCP901213’, ‘meter’:‘37,398’, ‘meterUnit’:‘M’, ‘current’: false}, {‘date’: ‘11/04/2007’, ‘state’:‘WI’, ‘vin’:‘1VXBR12EXCP901213’, ‘meter’:‘12,269’, ‘meterUnit’:‘M’, ‘current’: false}, {‘date’: ‘08/19/2005’, ‘state’:‘OH’, ‘vin’:‘1VXBR12EXCP153842’, ‘meter’:‘3,220’, ‘meterUnit’:‘M’, ‘current’: false}, {‘date’: ‘06/22/2005’, ‘state’:‘OH’, ‘vin’:‘1VXBR12EXCP153842’, ‘meter’:’’, ‘meterUnit’:‘M’, ‘current’: false} ]}
Example #3 (report PDF):
http://api.vinaudit.com/pullreport.php?id=00000000000003&key=MY_KEY&vin=1VXBR12EXCP901213&mode=test&user=MY_USER&pass=MY_PASS&format=json&pdf=1

View Sample
Implementation Notes:
This request can be re-issued repeatedly using the same ID and VIN.
Your API account is billed at most once for each unique report ID.
Once generated, re-issuing the request will return the cached report data.
An extended API is also available for finer-grained control.

I’m not going to code the whole thing for you, but it’s pretty cool to do a VIN Lookup.

Below is an examply using curl to make a json call.

[php]$data = array(“vin” => “YourVinNumberYouAreLookingUp”, “key” => “YourKey”, “format” => “json”);
$data_string = json_encode($data);

$ch = curl_init(‘https://api.vinaudit.com/query.php’);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Content-Type: application/json’,
'Content-Length: ’ . strlen($data_string))
);

$result = curl_exec($ch);[/php]

If everything works right, then $result should contain all the information they are passing back to you and you’ll have to parse it and display it. This is just an example, it might or might not work.

I honestly appreciate your responce sir but you see inputing the vin number is done using a form. And like I said I am vvery new to this…very green indeed

I know once you get the vin number from the form you have to put in in the API call, which is shown above.

Are you having trouble creating the form or making the call to the API?

I am having trouble adding the vin to the string that makes the call to the API

Post your code - So I can see it.

This is the string that calls the API https://api.vinaudit.com/query.php?vin=1VXBR12EXCP901213&key=YOUR_KEY&format=xml the vin is just for for sample purpose hence needs to be replaced every time a fresh query is required through the form provided for the query on the front end. I don’t know how to get the form to put the vin in the string that calls the api using the post ot get parameter

I’m asking you to show me the code to the form you created. Where the user types in the VIN #.

      <tr>
        <td height="46" align="center" bgcolor="#BED780"><form action=" https://api.vinaudit.com/query.php?vin=1VXBR12EXCP901213&key=YOUR_KEY&format=json" method="post" name="vin" target="_blank" id="vin">
          <br>
          <table width="653" align="center">
            <tr>
              <td colspan="2"><img name="index_17" src="images/index_17.gif" width="300" height="29" border="0" alt=""></td>
              <td width="341"><input name="textfield" type="text" size="40">
                  <input type="submit" name="Submit" value="Submit"></td>
            </tr>
          </table>
        </form>              </td>
      </tr>

The url is http://www.checkthisauto.com

The form code as requested pls ignore the previouse one I sent

$data = array(“vin” => “YourVinNumberYouAreLookingUp”, “key” => “YourKey”, “format” => “json”);
$data_string = json_encode($data);

$ch = curl_init(‘https://api.vinaudit.com/query.php’);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Content-Type: application/json’,
'Content-Length: ’ . strlen($data_string))
);

$result = curl_exec($ch);

Am sorry i am just getting a gip of the forum pls ignore my previouse Post
This is my form script


I think this is what you’re looking for… Eventhough I disagree on how you’re trying to accomplish what you’re accomplishing, you are exposing your KEY.

[php]


[/php]

Waw! It works karma. But yes as you correctly said it exposes my key… Please how do I cross this huddle ?I must express my joy abt the kind of responses I hv received since I joined this forum u guys are the best…I still need to solve the problem.

You need to do what @phphelp said to do…

Just like you rightly pointed out that the approach to sending the query to the API is wrong becouse it exposes my key. If I can get a code that will send the query string (that contains my key) to the API. So all the form doess is send the vin to a new page (that contains the code)that sends the query to the API the results now loads on a seprate page hence my key is not exposed.

Pretty much, you make the Json or XML call like @Phphelp said to do, which is HTTPS, so the data is encrypted when being sent over. The VIN place, returns to you the json or XML and you parse that information and display it however you want on the screen.

It will take some work and time parsing and designing a screen with all the information to make it look good. But I’m sure you can do it, just need to put your head down and take baby steps and put it all together.

Sponsor our Newsletter | Privacy Policy | Terms of Service