0

我正在尝试使用 SubmitFeed 操作更新数量。这个事情谁有经验?我收到的错误是:“必须存在操作或操作查询参数”,但查询字符串中确实有“操作 = SubmitFeed”。

我编写了其他四个可以完美运行的函数(RequestReport、GetReportRequestList、GetReport 和 GetFeedSubmissionList)。我想我缺少一些 cURL 配置选项来发布文件。

卷曲选项:

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER => array(
    'Content-Type: application/x-www-form-urlencoded',
    'Content-MD5: '. $md5,
    'Transfer-Encoding: chunked',
)),
curl_setopt($ch, CURLINFO_HEADER_OUT => true);
curl_setopt($ch, CURLOPT_UPLOAD => true);
curl_setopt($ch, CURLOPT_PROTOCOLS => CURLPROTO_HTTPS);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_PORT , 443);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $url_parts));

有人可以帮忙吗?谢谢你。

4

1 回答 1

0

为了进行SubmitFeed呼叫,您必须将Content-Type: text/xmlXML 提要用作 CURLOPT_POSTFIELDS。您的其他选项字段必须进入 URL,就好像这是GET

$ch = curl_init($url_with_fields);                   <-- change 1
curl_setopt($ch, CURLOPT_HTTPHEADER => array(
    'Content-Type: text/xml',                        <-- change 2
    'Content-MD5: '. $md5,
    'Transfer-Encoding: chunked',
)),
curl_setopt($ch, CURLINFO_HEADER_OUT => true);
curl_setopt($ch, CURLOPT_UPLOAD => true);
curl_setopt($ch, CURLOPT_PROTOCOLS => CURLPROTO_HTTPS);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_PORT , 443);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);      <-- change 3

请注意,这种类型的调用适用于 RequestReport、GetReportRequestList、GetReport 和 GetFeedSubmissionList:在这些情况下,只需将 $xmldata 留空。

于 2013-04-20T18:12:35.977 回答