I've this cUrl
curl -X POST \
-H "Authorization: Key {api-key}" \
-H "Content-Type: application/json" \
-d '
{
"inputs": [
{
"data": {
"image": {
"url": "https://samples.clarifai.com/metro-north.jpg"
}
}
}
]
}'\
https://api.clarifai.com/v2/models/aaa03c23b3724a16a56b629203edc62c/outputs
I want to make Post request with PHP so i can get json response. I've tried this:
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPAUTH => $token,
CURLOPT_POSTFIELDS => $img_url,
CURLOPT_URL => 'https://api.clarifai.com/v2/models/aaa03c23b3724a16a56b629203edc62c/outputs',
CURLOPT_USERAGENT => 'Codular Sample cURL Request'
));
But this doesn't work. Any help would be greatly appreciated.
Error:
array(1) { ["status"]=> array(3) { ["code"]=> int(11102) ["description"]=> string(15) "Invalid request" ["details"]=> string(28) "Malformed or invalid request" } }