Here is are two links to the documentation for the API I am trying to connect to.
The second link is an the xml schema, I am only updating the price of my items so I only used the
ProductCode and the ProductPrice tags.
https://volusionhome.my.site.com/knowledgebase/s/article/DeveloperResources
https://helpcenter.volusion.com/s/article/ProductManagementProductsDeveloper
The PHP example is in a section that only users can access, here is a copy of the php example:
<?php
// 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 .= " xml input file for \"\"";
$Xml_to_Send .= "-->";
$Xml_to_Send .= "</Volusion_API>";
// Create the Header
$url = "https://www.domain.com/net/WebService.aspx?Login=UserEmail&EncryptedPassword=UserPassword&Import=Insert";
$header = "POST".$url." HTTP/1.0 \r\n";
$header .= "MIME-Version: 1.0 \r\n";
$header .= "Content-type: text/xml; charset=utf-8 \r\n";
$header .= "Content-length: ".strlen($post_string)." \r\n";
$header .= "Content-transfer-encoding: text \r\n";
$header .= "Request-number: 1 \r\n";
$header .= "Document-type: Request \r\n";
$header .= "Interface-Version: Test 1.4 \r\n";
$header .= "Connection: close \r\n\r\n";
$header .= $Xml_to_Send;
// Post and Return Xml
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $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;
?>
When I was working with this API and debugging the issue I did try using cURL and the Content-type of "text/xml" like this example and I got a different error that reads:
"No XML Found to Import!"
I found that this error is based on the content type, That is why I am using the application/x-www-form-urlencoded content type.
also before posting the original question I changed the XML a bit so in my code the parent tags are
<Volusion_API>
...
</Volusion_API>
Again thanks for any help that you can give me