【发布时间】:2019-11-23 14:54:40
【问题描述】:
我想从他们的文档中使用https://remove.bg api 删除图像背景,因为我是新来使用 curl 的,这是我想出的
$url = "https://api.remove.bg/v1.0/removebg";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'x-api-key: my-api-key',
'image_url:https://example.com/image-to-remove-bg.png'
));
$server_output = curl_exec ($ch);
curl_close ($ch);
print_r($server_output);
但它返回的是空的身体;请您帮助我或指出我哪里做错了。
【问题讨论】:
标签: php api curl imagebackground