Discussions
The code from the example does not work
I copied the code from the example, but it keeps returning an error {"code":40002,"message":"Image format not supported"}.
What can be done to make it work?
$imageb='data:image/png;name=Vera.png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAiA/WF/x+eR/h+BpgSDbzx7ZgAAAABJRU5ErkJggg==';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://upload.heygen.com/v1/talking_photo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>$imageb,
CURLOPT_HTTPHEADER => [
"Content-Type: image/png",
"X-API-KEY:" .$apikey,
"accept: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}