HI,
My script for API VISION no longer works for me. Everything worked until last week.
I use PHP and CURL, and I get error Status Code 400.
This is my code:
$url="https://vision.googleapis.com/v1/images:annotate?key=$apikey";
$detection_type="WEB_DETECTION";
// base64 encode image
// $image=file_get_contents($url_immagine);
// $image_base64=base64_encode($image);
$json_request='{
"requests": [
{
"image": {
"content":"'.$url_jpg.'"
},
"features": [
{
"type": "'.$detection_type.'",
"maxResults": 400
}
]
}
]
}';
$curl=curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json_request);
$json_response=curl_exec($curl);
$status=curl_getinfo($curl, CURLINFO_HTTP_CODE);
$curl_errno= curl_errno($curl);
curl_close($curl);
if ( $status!=200 ) {
die("Status code: $status <br> $curl_errno" );
}
Is the API url still valid? What has changed?