fork download
  1. <?php
  2.  
  3. // Define the URL and the data
  4. $url = "https://s...content-available-to-author-only...c.in/api/v2/createMerchantToken";
  5. $data = [
  6. 'mid' => 'Your Merchant ID', // Replace with your Merchant ID
  7. 'password' => 'Your Account Password' // Replace with your Account Password
  8. ];
  9.  
  10. // Initialize cURL
  11. $ch = curl_init($url);
  12.  
  13. // Set cURL options
  14. curl_setopt($ch, CURLOPT_POST, true);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  17. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  18. 'Content-Type: application/json',
  19. 'Content-Length: ' . strlen(json_encode($data))
  20. ]);
  21.  
  22. // Execute cURL request
  23. $response = curl_exec($ch);
  24.  
  25. // Check for errors
  26. if ($response === false) {
  27. die('cURL Error: ' . curl_error($ch));
  28. }
  29.  
  30. // Close cURL session
  31.  
  32. // Decode the JSON response
  33. $responseData = json_decode($response, true);
  34.  
  35. // Check the response
  36. if ($responseData['status'] === true) {
  37. echo "Response received: ";
  38. print_r($responseData);
  39. } else {
  40. echo "Error: " . $responseData['msg'];
  41. }
  42. ?>
  43.  
Success #stdin #stdout 0.02s 26592KB
stdin
Standard input is empty
stdout
cURL Error: Could not resolve host: server.paygic.in