fork download
  1. <?php
  2.  
  3. $curl = curl_init();
  4.  
  5. CURLOPT_URL => 'https://a...content-available-to-author-only...l.com/transactions/2020979/status?clientReference=INV-987',
  6. CURLOPT_RETURNTRANSFER => true,
  7. CURLOPT_ENCODING => '',
  8. CURLOPT_MAXREDIRS => 10,
  9. CURLOPT_TIMEOUT => 0,
  10. CURLOPT_FOLLOWLOCATION => true,
  11. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  12. CURLOPT_CUSTOMREQUEST => 'GET',
  13. CURLOPT_HTTPHEADER => array(
  14. 'Authorization: Basic alpZMzB5WTo4ZDMwOGI5YWRlOTM0M2M4YmIzOWUzNmUwMzk1Mzk4OQ=='
  15. ),
  16. ));
  17.  
  18. // Execute request
  19. $response = curl_exec($curl);
  20.  
  21. // Capture HTTP status code
  22. $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  23.  
  24. // Capture cURL errors
  25. $curlError = curl_error($curl);
  26.  
  27. curl_close($curl);
  28.  
  29. // Debugging output
  30. echo "HTTP Response Code: $httpCode\n";
  31. if ($curlError) {
  32. echo "cURL Error: $curlError\n";
  33. }
  34. echo "Response:\n$response\n";
  35.  
Success #stdin #stdout 0.04s 26084KB
stdin
Standard input is empty
stdout
HTTP Response Code: 0
cURL Error: Could not resolve host: api-txnstatus.hubtel.com
Response: