var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.vehicledatabases.com/licenseplate-ocr',
'headers': {
'x-AuthKey': '{X-AUTHKEY}'
},
formData: {
'file': {
'value': fs.createReadStream('test.jpg'),
'options': {
'filename': 'SC2.jpg',
'contentType': ""
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('test.jpg'));
var config = {
method: 'post',
url: 'https://api.vehicledatabases.com/licenseplate-ocr',
headers: {
'x-AuthKey': '{X-AUTHKEY}',
...data.getHeaders()
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.vehicledatabases.com/licenseplate-ocr',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('test.jpg')),
CURLOPT_HTTPHEADER => array(
'x-AuthKey: {X-AUTHKEY}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response
import requests
url = "https://api.vehicledatabases.com/licenseplate-ocr"
payload={}
files=[
('file',('SC2.jpg',open('test.jpg','rb'),'image/jpeg'))
]
headers = {
'x-AuthKey': '{X-AUTHKEY}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)