Advertisement
fabi0

Untitled

Jan 16th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. define('MARKETPLACE_URL', 'https://marketplace.emag.bg');
  4. define('MARKETPLACE_API_URL', 'https://marketplace.emag.bg/api-3');
  5. define('MARKETPLACE_API_URL', 'https://marketplace.emag.bg/api-3');
  6.  
  7. $data =
  8. array (
  9. 'currentPage' => 1,
  10. 'itemsPerPage' => 10
  11. );
  12.  
  13.  
  14. $hash = sha1(http_build_query($data).sha1('lancombg123'));
  15.  
  16. $requestData = array(
  17. 'username' => 'lancombg',
  18. 'data' => $data,
  19. 'hash' => $hash);
  20.  
  21. $ch = curl_init();
  22.  
  23. curl_setopt($ch, CURLOPT_URL, MARKETPLACE_URL . '/api-3/category/read');
  24.  
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  26. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  27. curl_setopt($ch, CURLOPT_HEADER, 0);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  29. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  30.  
  31. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestData));
  32.  
  33. $result = curl_exec($ch);
  34. echo '<pre>' . print_r($result, true) . '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement