"https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles", CURLOPT_RETURNTRANSFER => true, ...

0
mudasir abbas turi 8 Янв 2021 в 11:15

1 ответ

Лучший ответ
function reg_form()
{
    $form = "
            <form method='GET' action='http://qwikcarbuyer.com/car-data'>
              <input type='text' name='q'>
              <input style='width:100%;margin-top:3px;' type='submit' name='submit'>
            </form>
              ";

    return $form;
}

add_shortcode('get_reg_form', 'reg_form');

function get_vehicle_api()
{



$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  
   => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\t\"registrationNumber\": \"AA19AAA\"\n}",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: REPLACE WITH YOUR API KEY",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>
0
mudasir abbas turi 8 Янв 2021 в 15:08