I've been trying to use the Volusion API to import order data with no luck and support through Volusion is limited. I tend to lean towards a PHP solution, and their web site has this example for using the API for Import with php...
<?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.xxxxxcomusa.com/net/WebService.aspx?Login=xxxxx@xxxxcomusa.com &EncryptedPassword=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&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; ?>
I've edited this accordingly in order to get an order updated (used "Import=Update") but there is no 'data' output on the resulting page and the record does not get updated. I am able to get data returned from the api using a similar url so I know my encrypted password is correct. I think I also determined that the line that reads...
$header = "POST".$url." HTTP/1.0 \r\n";
should read ...
$header = "POST ".$url." HTTP/1.0 \r\n";
with a space after POST but I'm still not able to successfully update a record. I was hoping someone might have had success and can share more specifics on how you were able to import an update using the Volusion API (and hopefully PHP).
No comments:
Post a Comment