mivajenn
5/26/2017 - 6:23 PM

Sample_Request_Using_PHP.js

<?php
//display all errors
ini_set('error_reporting', E_ALL);
define('POSTURL', 'http://bheyde.mivamerchantdev.com/mm5/json.mvc?Function=Module&Module_Code=remoteprovisioning&Module_Function=XML' );
define('ACCESSTOKEN', '90375a3969c6e0f6dd60d57a321a16ba' );
$xml_data = "
<Provision>
        <Store code=\"Store_Code\">
                  <Product_Add>
                  <Code>armor-padded</Code>
                  <Name><![CDATA[Padded Armor]]></Name>
                  <Price>50.00</Price>
                  <Cost>37.50</Cost>
                  <Weight>10.00</Weight>
                  <Description><![CDATA[My Description...]]></Description>
                  <Taxable>Yes</Taxable>
                  <Active>Yes</Active>
                  <ThumbnailImage></ThumbnailImage>
                  <FullSizeImage></FullSizeImage>
        </Product_Add>
    </Store>
</Provision>
";
$ch = curl_init(POSTURL);
curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS ,$xml_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                    'Content-type: text/xml',
                    'MMProvision-Access-Token: ' . ACCESSTOKEN,
                    'Content-length: ' . strlen($xml_data)
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL
$response = curl_exec($ch);
header('Content-type: text/xml');
echo($response);
curl_close($ch);
?>