fork download
  1. <?php
  2. $ratesRequest = [
  3. 'grant_type' => 'client_credentials',
  4. 'client_id' => 'l7b12d7a7111ed4d6780f368c8cf681f94',
  5. 'client_secret' => 'af0862ad22ff486b8bfa7cb0e4ef0abe',
  6. ];
  7.  
  8. $url = "https://a...content-available-to-author-only...x.com/oauth/token";
  9. $request = curl_init();
  10. curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($request, CURLOPT_TIMEOUT, 60);
  12. curl_setopt($request, CURLOPT_POST, 1);
  13. curl_setopt($request, CURLOPT_HTTPHEADER, array(
  14. 'Content-Type' => 'application/x-www-form-urlencoded'
  15. ));
  16. curl_setopt($request, CURLOPT_URL, $url);
  17.  
  18. curl_setopt($request, CURLOPT_POSTFIELDS, http_build_query($ratesRequest));
  19.  
  20. $response = curl_exec($request);
  21. $response = json_decode($response, 1);
  22. echo $response;
  23. ?>
  24.  
Success #stdin #stdout 0.03s 25808KB
stdin
Standard input is empty
stdout
Standard output is empty