Advertisement
Guest User

Untitled

a guest
May 1st, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1.  
  2.  
  3.         $marketplace = 'https://marketplace.emag.bg';
  4.         $password = '...';
  5.         $user = 'mbvison@mailinator.com';
  6.         $emagHash = base64_encode($user . ':' . $password);
  7.    
  8.         $product_data = array(
  9.             'itemsPerPage' => 500,
  10.             'currentPage' => 1
  11.         );
  12.        
  13.         $headers = array('Authorization: Basic ' . $emagHash);
  14.        
  15.         $requestData = array(
  16.             'data' => $product_data,
  17.         );
  18.        
  19.         $ch = curl_init();
  20.        
  21.         curl_setopt($ch, CURLOPT_URL, $marketplace.'/api-3/product_offer/read');
  22.        
  23.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  24.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  25.         curl_setopt($ch, CURLOPT_HEADER, 0);
  26.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  27.         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  28.        
  29.         curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestData));
  30.         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  31.        
  32.         $result = curl_exec($ch);
  33.         curl_close($ch);
  34.        
  35.         $result = json_decode($result, true);
  36.  
  37.         var_dump($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement