Guest User

Untitled

a guest
Mar 29th, 2018
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.73 KB | None | 0 0
  1. <?php
  2. $soapUrl = "https://www.amazon.com/eprocurement/punchout";
  3. $xml_post_string = '<?xml version = "1.0" encoding = "UTF-8"?>
  4. <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.007/cXML.dtd">
  5. <cXML version="1.2.007" xml:lang="en-US" payloadID="123456.123456@amazon.com" timestamp="2016-09-01T01:50:29-05:00">
  6. <Header>
  7. <From>
  8. <Credential domain="NetworkId">
  9. <Identity>abcd123</Identity>
  10. </Credential>
  11. </From>
  12. <To>
  13. <Credential domain="NetworkId">
  14. <Identity>Amazon</Identity>
  15. </Credential>
  16. </To>
  17. <Sender>
  18. <Credential domain="NetworkId">
  19. <Identity> abcd123</Identity>
  20. <SharedSecret>test secret</SharedSecret>
  21. </Credential>
  22. <UserAgent>amazon.com</UserAgent>
  23. </Sender>
  24. </Header>
  25. <Request>
  26. <PunchOutSetupRequest operation="create">
  27. <BuyerCookie>1234567</BuyerCookie>
  28. <Extrinsic name="RequestID">5826623</Extrinsic>
  29. <Extrinsic name="MUDID">CLS21518</Extrinsic>
  30. <Extrinsic name="Location">RTP</Extrinsic>
  31. <Extrinsic name="Country">UNITED STATES</Extrinsic>
  32. <Extrinsic name="Email">user@email.org</Extrinsic>
  33. <Extrinsic name="ClientMUDID">CLS21518</Extrinsic>
  34. <Extrinsic name="UserEmail">user@email.org</Extrinsic>
  35. <Extrinsic name="Division">Corporate</Extrinsic>
  36. <Extrinsic name="StartDate">1/9/2016 2:34:36 PM</Extrinsic>
  37. <BrowserFormPost>
  38. <URL>http://www.test.com/ test/response.php</URL>
  39. </BrowserFormPost>
  40. <Contact>
  41. <Name xml:lang="en-US">Jones, Tom</Name>
  42. <Email>user@email.org</Email>
  43. </Contact>
  44. <SupplierSetup>
  45. <URL>http://workchairs.com/cxml</URL>
  46. </SupplierSetup>
  47. </PunchOutSetupRequest>
  48. </Request>
  49. </cXML>';
  50.  
  51. $headers = array(
  52. "Content-type: text/xml;charset="utf-8"",
  53. "Accept: text/xml",
  54. "Cache-Control: no-cache",
  55. "Pragma: no-cache",
  56. "SOAPAction: https://www.amazon.com/eprocurement/punchout",
  57. "Content-length: ".strlen($xml_post_string),
  58. );
  59.  
  60. $url = $soapUrl;
  61. $ch = curl_init();
  62. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  63. curl_setopt($ch, CURLOPT_URL, $url);
  64. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  65. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  66. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  67. curl_setopt($ch, CURLOPT_POST, true);
  68. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
  69. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  70. $response = curl_exec($ch);
  71. curl_close($ch);
  72. echo "<pre>"; print_r($parser); exit;
  73. ?>
  74.  
  75. SimpleXMLElement Object
  76. (
  77. [@attributes] => Array
  78. (
  79. [payloadID] => 1234567981324.123.1234@amazon.com
  80. [timestamp] => 2016-09-01T10:37:29+10:37
  81. )
  82.  
  83. [Response] => SimpleXMLElement Object
  84. (
  85. [Status] => SimpleXMLElement Object
  86. (
  87. [@attributes] => Array
  88. (
  89. [code] => 200
  90. [text] => success
  91. )
  92.  
  93. )
  94.  
  95. [PunchOutSetupResponse] => SimpleXMLElement Object
  96. (
  97. [StartPage] => SimpleXMLElement Object
  98. (
  99. [URL] => https://www.amazon.com/eprocurement/initiate-clean-punchout/123-1234567-1234567
  100. )
  101.  
  102. )
  103.  
  104. )
  105.  
  106. )
  107.  
  108. SimpleXMLElement Object
  109. (
  110. [@attributes] => Array
  111. (
  112. [payloadID] => 1234567981234.105.9597@amazon.com
  113. [timestamp] => 2016-09-01T10:37:53.985Z
  114. )
  115.  
  116. [Header] => SimpleXMLElement Object
  117. (
  118. [From] => SimpleXMLElement Object
  119. (
  120. [Credential] => Array
  121. (
  122. [0] => SimpleXMLElement Object
  123. (
  124. [@attributes] => Array
  125. (
  126. [domain] => DUNS
  127. )
  128.  
  129. [Identity] => 123465789
  130. )
  131.  
  132. [1] => SimpleXMLElement Object
  133. (
  134. [@attributes] => Array
  135. (
  136. [domain] => NetworkId
  137. )
  138.  
  139. [Identity] => Amazon
  140. )
  141.  
  142. )
  143.  
  144. )
  145.  
  146. [To] => SimpleXMLElement Object
  147. (
  148. [Credential] => SimpleXMLElement Object
  149. (
  150. [@attributes] => Array
  151. (
  152. [domain] => NetworkId
  153. )
  154.  
  155. [Identity] => abcd123
  156. )
  157.  
  158. )
  159.  
  160. [Sender] => SimpleXMLElement Object
  161. (
  162. [Credential] => Array
  163. (
  164. [0] => SimpleXMLElement Object
  165. (
  166. [@attributes] => Array
  167. (
  168. [domain] => DUNS
  169. )
  170.  
  171. [Identity] => 123456789
  172. )
  173.  
  174. [1] => SimpleXMLElement Object
  175. (
  176. [@attributes] => Array
  177. (
  178. [domain] => NetworkId
  179. )
  180.  
  181. [Identity] => Amazon
  182. )
  183.  
  184. )
  185.  
  186. [UserAgent] => Amazon LLC eProcurement Application
  187. )
  188.  
  189. )
  190.  
  191. [Message] => SimpleXMLElement Object
  192. (
  193. [PunchOutOrderMessage] => SimpleXMLElement Object
  194. (
  195. [BuyerCookie] => 1234567
  196. [PunchOutOrderMessageHeader] => SimpleXMLElement Object
  197. (
  198. [@attributes] => Array
  199. (
  200. [operationAllowed] => create
  201. )
  202.  
  203. [Total] => SimpleXMLElement Object
  204. (
  205. [Money] => 1.88
  206. )
  207.  
  208. )
  209.  
  210. [ItemIn] => SimpleXMLElement Object
  211. (
  212. [@attributes] => Array
  213. (
  214. [quantity] => 1
  215. )
  216.  
  217. [ItemID] => SimpleXMLElement Object
  218. (
  219. [SupplierPartID] => D00004ABC1
  220. [SupplierPartAuxiliaryID] => 123-1234567-1234567,1
  221. )
  222.  
  223. [ItemDetail] => SimpleXMLElement Object
  224. (
  225. [UnitPrice] => SimpleXMLElement Object
  226. (
  227. [Money] => 1.88
  228. )
  229.  
  230. [Description] => Mead Composition Book, Wide Ruled, 9.75 x 7.50 Inch Sheet Size, Black Marble, Bookbound, 100 Sheets (09910)
  231. [UnitOfMeasure] => EA
  232. [Classification] => 14111514
  233. [ManufacturerPartID] => UPC-800187711702
  234. [ManufacturerName] => MeadWestvaco Consumer & Office Products
  235. [Extrinsic] => Array
  236. (
  237. [0] => Amazon
  238. [1] => Amazon
  239. [2] => gl_office_product
  240. [3] => OFFICE_PRODUCTS
  241. [4] => New
  242. [5] => true
  243. )
  244.  
  245. )
  246.  
  247. )
  248.  
  249. )
  250.  
  251. )
  252.  
  253. )
Add Comment
Please, Sign In to add comment