I develop a web service/script in php that retrieve data from my vendor site in json format. i convert that data into XML and pass to my Volusion API for import/Insertion But it just return 1. I don't know why the product is not inserted when i check it in the Volusion admin.
This my API request format. http://tebkq.mvlce.servertrust.com/net/WebService.aspxLogin=mylogin&EncryptedPassword=mypass&Import=Insert
Anyone who knows please help me. My code as under..
<?php
$file = file_get_contents('dataPro.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://tebkq.mvlce.servertrust.com/net/WebService.aspxLogin=mylogin&EncryptedPassword=mypass&Import=Insert";
// Create the Header
$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;
?>