fork download
  1. <?php
  2. $secret_key = 'sk_test_51PrGD1DatwCeUkw2FqfjBmMxhMA9WC2WqeCAwXbBlspKzr4qkC3G701EX3nKkasvn5mFdpGORSYFUjq33tdy0CDT00xRD99Rcs';
  3. // Set up the cURL request
  4. $ch = curl_init();
  5.  
  6. curl_setopt($ch, CURLOPT_URL, "https://a...content-available-to-author-only...e.com/v1/subscriptions/sub_1Q3xakDatwCeUkw2uY0f3SmU");
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($ch, CURLOPT_POST, true);
  9.  
  10. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  11. 'Authorization: Bearer ' . $secretKey,
  12. 'Content-Type: application/x-www-form-urlencoded',
  13. ]);
  14.  
  15. // Set the parameters for the update
  16. $postFields = [
  17. 'cancel_at_period_end' => 'true',
  18. ];
  19.  
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
  21.  
  22. // Execute the request
  23. $response = curl_exec($ch);
  24.  
  25. // Check for errors
  26. if (curl_errno($ch)) {
  27. $responseData = false;
  28. // curl_error($ch);
  29. } else {
  30. // Decode the response
  31. $responseData = $response;
  32. }
  33.  
  34. return $response_data;
  35. // Close the cURL session
  36. curl_close($ch);
  37. ?>
Success #stdin #stdout #stderr 0.03s 26228KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined variable: secretKey in /home/UAIqXU/prog.php on line 11
PHP Notice:  Undefined variable: response_data in /home/UAIqXU/prog.php on line 34