Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $soapUrl = "https://www.amazon.com/eprocurement/punchout";
- $xml_post_string = '<?xml version = "1.0" encoding = "UTF-8"?>
- <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.007/cXML.dtd">
- <cXML version="1.2.007" xml:lang="en-US" payloadID="123456.123456@amazon.com" timestamp="2016-09-01T01:50:29-05:00">
- <Header>
- <From>
- <Credential domain="NetworkId">
- <Identity>abcd123</Identity>
- </Credential>
- </From>
- <To>
- <Credential domain="NetworkId">
- <Identity>Amazon</Identity>
- </Credential>
- </To>
- <Sender>
- <Credential domain="NetworkId">
- <Identity> abcd123</Identity>
- <SharedSecret>test secret</SharedSecret>
- </Credential>
- <UserAgent>amazon.com</UserAgent>
- </Sender>
- </Header>
- <Request>
- <PunchOutSetupRequest operation="create">
- <BuyerCookie>1234567</BuyerCookie>
- <Extrinsic name="RequestID">5826623</Extrinsic>
- <Extrinsic name="MUDID">CLS21518</Extrinsic>
- <Extrinsic name="Location">RTP</Extrinsic>
- <Extrinsic name="Country">UNITED STATES</Extrinsic>
- <Extrinsic name="Email">user@email.org</Extrinsic>
- <Extrinsic name="ClientMUDID">CLS21518</Extrinsic>
- <Extrinsic name="UserEmail">user@email.org</Extrinsic>
- <Extrinsic name="Division">Corporate</Extrinsic>
- <Extrinsic name="StartDate">1/9/2016 2:34:36 PM</Extrinsic>
- <BrowserFormPost>
- <URL>http://www.test.com/ test/response.php</URL>
- </BrowserFormPost>
- <Contact>
- <Name xml:lang="en-US">Jones, Tom</Name>
- <Email>user@email.org</Email>
- </Contact>
- <SupplierSetup>
- <URL>http://workchairs.com/cxml</URL>
- </SupplierSetup>
- </PunchOutSetupRequest>
- </Request>
- </cXML>';
- $headers = array(
- "Content-type: text/xml;charset="utf-8"",
- "Accept: text/xml",
- "Cache-Control: no-cache",
- "Pragma: no-cache",
- "SOAPAction: https://www.amazon.com/eprocurement/punchout",
- "Content-length: ".strlen($xml_post_string),
- );
- $url = $soapUrl;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $response = curl_exec($ch);
- curl_close($ch);
- echo "<pre>"; print_r($parser); exit;
- ?>
- SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [payloadID] => 1234567981324.123.1234@amazon.com
- [timestamp] => 2016-09-01T10:37:29+10:37
- )
- [Response] => SimpleXMLElement Object
- (
- [Status] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [code] => 200
- [text] => success
- )
- )
- [PunchOutSetupResponse] => SimpleXMLElement Object
- (
- [StartPage] => SimpleXMLElement Object
- (
- [URL] => https://www.amazon.com/eprocurement/initiate-clean-punchout/123-1234567-1234567
- )
- )
- )
- )
- SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [payloadID] => 1234567981234.105.9597@amazon.com
- [timestamp] => 2016-09-01T10:37:53.985Z
- )
- [Header] => SimpleXMLElement Object
- (
- [From] => SimpleXMLElement Object
- (
- [Credential] => Array
- (
- [0] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [domain] => DUNS
- )
- [Identity] => 123465789
- )
- [1] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [domain] => NetworkId
- )
- [Identity] => Amazon
- )
- )
- )
- [To] => SimpleXMLElement Object
- (
- [Credential] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [domain] => NetworkId
- )
- [Identity] => abcd123
- )
- )
- [Sender] => SimpleXMLElement Object
- (
- [Credential] => Array
- (
- [0] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [domain] => DUNS
- )
- [Identity] => 123456789
- )
- [1] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [domain] => NetworkId
- )
- [Identity] => Amazon
- )
- )
- [UserAgent] => Amazon LLC eProcurement Application
- )
- )
- [Message] => SimpleXMLElement Object
- (
- [PunchOutOrderMessage] => SimpleXMLElement Object
- (
- [BuyerCookie] => 1234567
- [PunchOutOrderMessageHeader] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [operationAllowed] => create
- )
- [Total] => SimpleXMLElement Object
- (
- [Money] => 1.88
- )
- )
- [ItemIn] => SimpleXMLElement Object
- (
- [@attributes] => Array
- (
- [quantity] => 1
- )
- [ItemID] => SimpleXMLElement Object
- (
- [SupplierPartID] => D00004ABC1
- [SupplierPartAuxiliaryID] => 123-1234567-1234567,1
- )
- [ItemDetail] => SimpleXMLElement Object
- (
- [UnitPrice] => SimpleXMLElement Object
- (
- [Money] => 1.88
- )
- [Description] => Mead Composition Book, Wide Ruled, 9.75 x 7.50 Inch Sheet Size, Black Marble, Bookbound, 100 Sheets (09910)
- [UnitOfMeasure] => EA
- [Classification] => 14111514
- [ManufacturerPartID] => UPC-800187711702
- [ManufacturerName] => MeadWestvaco Consumer & Office Products
- [Extrinsic] => Array
- (
- [0] => Amazon
- [1] => Amazon
- [2] => gl_office_product
- [3] => OFFICE_PRODUCTS
- [4] => New
- [5] => true
- )
- )
- )
- )
- )
- )
Add Comment
Please, Sign In to add comment