我正在尝试通过 Volusion API 将我的产品导入/插入到我的产品表中,我使用了 Volusion 提供的示例 PHP 代码。
$file = file_get_contents('C:\Users\Ray\Desktop\3.txt', true);
// Create the Xml to POST to the Webservice
$Xml_to_Send = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
$Xml_to_Send .= "<Volusion_API>";
// $Xml_to_Send .= "<!--";
$Xml_to_Send .= $file;
// $Xml_to_Send .= "\"\"";
// $Xml_to_Send .= "-->";
$Xml_to_Send .= "</Volusion_API>";
$url = "http://.servertrust.com/net/WebService.aspx?Login=support@mysite.com&EncryptedPassword=1234&Import=Insert";
$header = array(
"MIME-Version: 1.0",
"Content-type: text/xml; charset=utf-8",
"Content-transfer-encoding: text",
"Request-number: 1",
"Document-type: Request",
"Interface-Version: Test 1.4"
);
// Post and Return Xml
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $Xml_to_Send);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);
// Check for Errors
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}
// Display the Xml Returned on the Browser
echo $data;
只要我的 xml 文件小于 10MB(这是常规导入的限制),此代码就可以很好地工作。当我尝试导入任何内容时,我收到此错误:
<ReturnResult>
<Success>False</Success>
<Message>Maximum request length exceeded.</message>
</ReturnResults>Send Failure: Connection was reset
有没有办法绕过这个限制?就像我说的那样,代码运行良好,直到我收到此错误时达到 10MB 限制。我要导入的当前文件只有 30MB。任何增加文件大小的脚本或解决方案???