Last active
April 19, 2018 19:01
-
-
Save crazytonyi/10222135ab7b4d9407d2103130a94cfa to your computer and use it in GitHub Desktop.
This file contains 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 | |
$client = new \GuzzleHttp\Client(); | |
$headers = ['x-api-key' => 'MY API KEY']; | |
$options = [ | |
'headers' => ['x-api-key' => 'MY API KEY'], | |
'debug' => true, | |
]; | |
try { | |
$resp = $client->request('GET', 'https://beta.check-mot.service.gov.uk',$options); | |
} catch (\GuzzleHttp\Exception\ClientException $e) { | |
$resp = $e->getResponse(); | |
} | |
echo $resp->getBody(); |
By using function?
public function apitest(){
$client = new \GuzzleHttp\Client();
$headers = ['x-api-key' => 'Key here'];
$options = [
'headers' => ['x-api-key' => 'Key here'],
'debug' => true,
];
try {
$resp = $client->request('GET', 'https://beta.check-mot.service.gov.uk/trade/vehicles/mot-tests\?registration=XX10ABC
',$options);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$resp = $e->getResponse();
}
echo $resp->getBody();
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The URL in the request.