Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.08 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $params = array(
  2.     'code' => '1234',
  3.     'client_id' => '492a34a0be1246c86de327d882cd77d8',
  4.     'client_secret' => 'c0dc2c9f5e3a102e6cf51f098e4d5dab',
  5.     'redirect_uri' => 'http://google.com',
  6.     'grant_type' => 'authorization_code',
  7. );
  8.  
  9. $body = http_build_query($params);
  10. $headers = array('Content-type' => 'application/x-www-form-urlencoded');
  11. $request = new StdRequest('https://api.soundcloud.com/oauth2/token', 'POST', $headers, $body);
  12. $client = new Client();
  13. $response = $client->request($request);
  14.  
  15.  
  16. // -------------------------------------------------------------------
  17. Sends the following raw HTTP request (which is perfectly valid):
  18. // -------------------------------------------------------------------
  19.  
  20. POST /oauth2/token HTTP/1.1
  21. HOST: api.soundcloud.com
  22. CONTENT-TYPE: application/x-www-form-urlencoded
  23. USER-AGENT: Artax-Http/0.1 (PHP5.3+)
  24. ACCEPT-ENCODING: gzip,deflate,identity
  25. CONTENT-LENGTH: 166
  26.  
  27. code=1234&client_id=492a34a0be1246c86de327d882cd77d8&client_secret=c0dc2c9f5e3a102e6cf51f098e4d5dab&redirect_uri=http%3A%2F%2Fgoogle.com&grant_type=authorization_code