我正在尝试将图像添加到现有的 Etsy 列表中。应该很简单吧?但我在这里关注 API 代码: https ://www.etsy.com/developers/documentation/reference/listingimage
并且收到内部服务器 500 错误响应:“”图像数组元数据看起来不像 _FILES 数组“”
我不知道这个错误是什么意思。任何人?
这是我的代码:
<?php
$oauth = new OAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
$oauth->enableDebug();
$oauth->setToken($access_token, $access_token_secret);
$listing_id = 245891757
$filename = 161784082898-0.JPG;
$mimetype="image/jpeg";
try {
$source_file = dirname(realpath(__FILE__)) ."/$filename";
$url = "https://openapi.etsy.com/v2/listings/".$listing_id."/images";
$params = array('image' => '@'.$source_file.';type='.$mimetype);
$oauth->fetch($url, $params, OAUTH_HTTP_METHOD_POST);
$json = $oauth->getLastResponse();
print_r(json_decode($json, true));
} catch (OAuthException $e) {
// You may want to recover gracefully here...
print "<br><br>".$oauth->getLastResponse()."\n";
print_r($oauth->debugInfo);
die($e->getMessage());
}
?>