[英]How do I POST data with cURL?
I apologize that there may be a problem with my phone because I use translation.我很抱歉我的手机可能有问题,因为我使用翻译。
I want to post xml to ebay systems but this is the error I got我想将 xml 发布到 ebay 系统,但这是我得到的错误
Error; ServerUnsupported content type: application/x-www-form-urlencoded1
<?php
$username = 'user';
$password = 'user123';
$xml_data = '<prod:deleteProduct>'.
' <apiKey>apikey1234</apiKey>'.
' <sign>rzdx7etHb3afTmtVQeyKPGjgzaSenb8987456465498</sign>'.
' <time>'.date("Y-m-d H:i:s").'</time>'.
' <productIdList>'.
' <item>539087067</item>'.
' </productIdList>'.
' <itemIdList>'.
' </itemIdList>'.
' <lang>tr</lang>'.
'</prod:deleteProduct>';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://dev.gittigidiyor.com:8443/listingapi/ws/IndividualProductService?wsdl');
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml_data);
$resul = curl_exec($ch);
curl_close($ch);
echo $resul;
?>
因为您发送 XML 数据所以Content-Type应该是text/xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.