【发布时间】:2020-11-23 02:41:15
【问题描述】:
我正在开发一个 OCR 项目,我正在尝试使用 vidado API。当我通过 posman 发送发布请求时,它给了我正确的响应,但是当我从 php 调用 API 时,它给了我以下错误
Client error: `POST https://api.vidado.ai/read/text` resulted in a `400 Bad Request` response: {"detail":"There was an error parsing the body"}
我的代码是
$client = new \GuzzleHttp\Client();
$url = "https://api.vidado.ai/read/text";
$requestAPI = $client->post( $url, [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'my apikey',
'Content-Type' => 'multipart/form-data'
],
'form_params' => [
'autoscale' => 'true',
'image'=> $img
],
]);
有人注意到实际的错误吗?所以请给我一个方法来做到这一点。 谢谢。
【问题讨论】:
-
你在 $img 里面放了什么?
-
@krylov123 图像对象
-
检查我的更新答案