$token = $this->getToken();
$url = 'http://api.weixin.qq.com/channels/ec/basics/img/upload?access_token='.$token.'&upload_type=1&resp_type=1';
$data = array(
'img_url' => "https://backwechat.xiamenfook.com/userfile/upload/2023-05-12/6973622782163.jpg"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_VERBOSE, true);
$response = curl_exec($ch);
if ($response === false) {
echo 'Error: ' . curl_error($ch);
} else {
echo $response;
}
var_dump(curl_error($ch));
curl_close($ch);确定token没有问题 返回结果只有“”
$data['img_url']json_encode时被转译了