fork download
  1.  
  2. <?php
  3.  
  4. $apiKey = '919eada62d02d31de309b04e1963e3b3';
  5. $endpoint = 'https://d...content-available-to-author-only...o.io/merchant_api/v1/customers';
  6.  
  7. $ch = curl_init($endpoint);
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  10. 'Authorization: ' . $apiKey,
  11. 'Content-Type: application/json',
  12. ]);
  13.  
  14. $response = curl_exec($ch);
  15.  
  16. if (curl_errno($ch)) {
  17. echo 'Curl error: ' . curl_error($ch);
  18. } else {
  19. $customers = json_decode($response, true);
  20. foreach ($customers as $customer) {
  21. if (isset($customer['points']) && $customer['points'] > 1) {
  22. // Process customers with more than 1 point
  23. print_r($customer);
  24. }
  25. }
  26. }
  27.  
  28. ?>
  29.  
Success #stdin #stdout 0.03s 26256KB
stdin
Standard input is empty
stdout
Curl error: Could not resolve host: developer-api.rivo.io