Guest User

Untitled

a guest
Sep 2nd, 2019
613
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ch = curl_init();
  2. curl_setopt($ch, CURLOPT_URL,"https://developer.api.walmart.com/api-proxy/service/affil/search?query=" . urlencode('Samsung Galaxy S10'));
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  4.  
  5. $customer_id = '3dfb07e2-2664-4b6a-83d1-0998cc1eddab';
  6. $timestamp = round(microtime(true) * 1000);
  7. $api_version = 1;
  8.  
  9. $headers = [
  10. "WM_CONSUMER.ID:$customer_id",
  11. "WM_CONSUMER.INTIMESTAMP:$timestamp",
  12. "WM_SEC.KEY_VERSION:$api_version",
  13. 'WM_QOS.CORRELATION_ID:-18006880586',
  14. 'WM_IFX.CLIENT_TYPE:INTERNAL',
  15. 'WM_PREVIEW:false',
  16. 'WM_SHOW_REASON_CODES:ALL',
  17. 'Content-Type:application/json'
  18. ];
  19.  
  20.  
  21. $private_key = <<<EOD
  22. -----BEGIN RSA PRIVATE KEY-----
  23. MIIEoQIBAAKCAQEApqmKihNxaN+U8V1esweS6f2GgVpSLuzGEXhkAyXJDatguuVY
  24. UIBBwdjuS6kSyLpajKzMtVg92py4BgpeMIbBOmXD8tXeDnbq4leilcpClMu7Xm9j
  25. 4SXdSqdpg/hcjKQDNCjU2r4WqyzcYR9j9Nf5xRB2mhNBMA7PAPlm6J1hjhpdeSLm
  26. 1QT8KvkUhooTN4d0X9Lko3i5rR5L5C28clDLmVsaLV6af6quplfKG0gq9ssx4vg/
  27. ycN1DdFV0lTMOgfydRfAibSntvaC3/JLWKyl0JoYP/TndJcyqt6O24HqrFLOh7nQ...
  28. -----END RSA PRIVATE KEY-----
  29. EOD;
  30.  
  31. $public_key = <<<EOD
  32. -----BEGIN PUBLIC KEY-----
  33. AAAAB3NzaC1yc2EAAAABJQAAAQEApqmKihNxaN+U8V1esweS6f2GgVpSLuzGEXhk
  34. AyXJDatguuVYUIBBwdjuS6kSyLpajKzMtVg92py4BgpeMIbBOmXD8tXeDnbq4lei
  35. lcpClMu7Xm9j4SXdSqdpg/hcjKQDNCjU2r4WqyzcYR9j9Nf5xRB2mhNBMA7PAPlm
  36. 6J1hjhpdeSLm1QT8KvkUhooTN4d0X9Lko3i5rR5L5C28clDLmVsaLV6af6quplfK
  37. G0gq9ssx4vg/ycN1DdFV0lTMOgfydRfAibSntvaC3/JLWKyl0JoYP/TndJcyqt6O
  38. 24HqrFLOh7nQBD542m5AJgZb8A5BSn2f3MwxDnaBq2xbnnFa6Q==
  39. -----END PUBLIC KEY-----
  40. EOD;
  41.  
  42.  
  43. $data = $customer_id . "\n" . $timestamp . "\n" . $api_version . "\n";
  44.  
  45. $binary_signature = "";
  46. openssl_sign($data, $binary_signature, $private_key, OPENSSL_ALGO_SHA1);
  47. $headers[] = 'WM_SEC.AUTH_SIGNATURE:' . base64_encode($binary_signature);
  48.  
  49. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  50. $server_output = curl_exec ($ch);
  51. curl_close ($ch);
  52. die(var_dump($server_output));
RAW Paste Data