php - 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
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;
?>
Answer
Solution:
Because you sending XML data so the Content-Type should be text/xml
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: videoxxx
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.