Advertisement
Guest User

Untitled

a guest
Aug 24th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. $product_data = array(
  2. array(
  3. 'id' => $subproduct_id,
  4. 'status' => 0,
  5. )
  6. );
  7.  
  8. $marketplace = 'https://marketplace.emag.bg';
  9. $password = 'anglingproshop123';
  10. $user = 'anglingproshop';
  11. $code = 'anglingproshop';
  12.  
  13. // $hash = sha1(http_build_query($product_data) . sha1($password)); //OLD
  14. $hash = base64_encode($user . ':' . $password);
  15. $headers = array('Authorization: Basic ' . $hash);
  16.  
  17. $requestData = array(
  18. //'code' => $code,
  19. //'username' => $user,
  20. 'data' => $product_data,
  21. //'hash' => $hash
  22. );
  23.  
  24. $ch = curl_init();
  25.  
  26. curl_setopt($ch, CURLOPT_URL, $marketplace.'/api-3/product_offer/read');
  27.  
  28. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  29. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  30. curl_setopt($ch, CURLOPT_HEADER, 0);
  31. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  32. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  33.  
  34. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestData));
  35. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  36.  
  37. $result = curl_exec($ch);
  38. curl_close($ch);
  39.  
  40. $result = json_decode($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement