' –– Create the object Set xmlPost = server.CreateObject ("MSXML2.XMLHTTP") ' –– Open a "POST" connection to the EZPrints Server. xmlPost.Open "POST","http://order.ezprints.com/PostXmlOrder.axd?PartnerNumber=XXX &PartnerReference=yyy" or"https://order.ezprints.com/PostXmlOrder.axd?PartnerNumber=XXX &PartnerReference=yyy"
' –– send the xml xmlPost.send strXML' –– Retrieve the response Response.Write xmlPost.ResponseText
Public Shared Function PostString(ByVal Data As String, ByVal Url As String, _ ByVal encode As Encoding) As String Dim result As String Dim webRequest As WebRequest = WebRequest.Create(Url) webRequest.Method = "POST" Dim bdata As Byte() = encode.GetBytes(Data) webRequest.ContentLength = bdata.Length Using requestStream As Stream = webRequest.GetRequestStream requestStream.Write(bdata, 0, bdata.Length) End Using Using webResponse As WebResponse = webRequest.GetResponse Using memoryStream As MemoryStream = New MemoryStream Dim length As Long = FileTransfer.TransferBytes(webResponse.GetResponseStream, memoryStream, _ &H2000, Nothing, New TimeSpan(0, 5, 0), Nothing, Nothing, New WaitHandle(0 - 1) {}) result = encode.GetString(memoryStream.GetBuffer, 0, CInt(length)) End Using End Using Return result End Function Public Shared Function PostString(ByVal Data As String, ByVal Url As String) As String Return WebHelper.PostString(Data, Url, Encoding.UTF8) End Function
<?php $PartnerNumber = '1'; // Your Partner Number Here $PartnerReference = '––Your Order Reference Here––'; $OrderXml = '<Order Test="true">––Your Order XML Here––</Order>'; $urlConn = curl_init ("https://order.ezprints.com/PostXmlOrder.axd? PartnerNumber=".$PartnerNumber."&PartnerReference=".urlencode($PartnerReference)); curl_setopt ($urlConn, CURLOPT_POST, 1); curl_setopt ($urlConn, CURLOPT_HTTPHEADER, array("Content-type", "text/xml")); curl_setopt ($urlConn, CURLOPT_POSTFIELDS, $OrderXml); curl_setopt ($urlConn, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($urlConn, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($urlConn); if (empty($result)) { print "ERROR: " . curl_error($urlConn) . "\n"; exit; } // Parse the response $xml = simplexml_load_string($result); echo "Obj:\r\n"; print_r($xml); echo "Reference="; echo $xml->attributes()->Reference; ?>
<?php $PartnerNumber = '1'; // Your Partner Number Here $PartnerReference = '––Your Order Reference Here––'; $OrderXml = '<Order Test="true">––Your Order XML Here––</Order>'; $OrderXml = 'xml='.urlencode($OrderXml); $urlConn = curl_init ("https://order.ezprints.com/PostXmlOrder.axd? PartnerNumber=".$PartnerNumber."&PartnerReference=".urlencode($PartnerReference)); curl_setopt ($urlConn, CURLOPT_POST, 1); // Can use application/x-www-urlencoded as well here curl_setopt ($urlConn, CURLOPT_HTTPHEADER, array("Content-type", "multipart/form-data")); curl_setopt ($urlConn, CURLOPT_POSTFIELDS, $OrderXml); curl_setopt ($urlConn, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($urlConn, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($urlConn); if (empty($result)) { print "ERROR: " . curl_error($urlConn) . "\n"; exit; } // Parse the response $xml = simplexml_load_string($result); echo "Obj:\r\n"; print_r($xml); echo "Reference="; echo $xml->attributes()->Reference; ?>
<?php $xml=$HTTP_RAW_POST_DATA; $obj=simplexml_load_string($xml); echo "Obj:\r\n"; print_r($obj); echo "Test="; echo $obj->attributes()->Test; ?>
<Order Test="true" />
// Generate an XML stringto send to EZPrints. $doc is a DOMDocument populated with // required EZPrints data. Alternatively the $ezPrintsXML string can be generated manually.$ezPrintsXML = $doc->saveXML();// create a header array that specifies a blank content type. $header[] = "Content-type:";// initialize CURL to use the EZPrints URL $ch = curl_init("http://g1order.ezprints.com/ezpartners/shippingcalculator/xmlshipcalc.asp"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Returns response data instead of TRUE curl_setopt($ch, CURLOPT_POST, true); // specify that POST should be used curl_setopt($ch, CURLOPT_HTTPHEADER, $header); // set the customized headers curl_setopt($ch, CURLOPT_POSTFIELDS, $ezPrintsXML); // use HTTP POST to send data $resp = curl_exec($ch); //execute post and get results as string into $resp variable curl_close ($ch); // close the curl object// $resp is the response from EZPrints. This will output that resultecho $resp;
var panoPrice = skuHash.get( sku ).price; var panoLength = " "; var panoInches = 0; var qty6InSegments = ""; var imgWidth = Number( item.originalWidth ); var imgHeight = Number( item.originalHeight ); var paperWidthInches = parseInt( skuHash.get( sku ).description ); var segmentLength = 6; if( imgWidth > imgHeight ) panoInches = ( imgWidth/imgHeight ) * paperWidthInches; else panoInches = ( imgHeight/imgWidth ) * paperWidthInches; qty6InSegments = Math.ceil(panoInches / segmentLength ); if (qty6InSegments < 2) qty6InSegments = 2; // Minimum length is 12 inches.panoPrice = ( skuHash.get( sku ).price * qty6InSegments) panoLength = Math.round(panoInches) + ' in long';