
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 1.08 KB | hits: 6 | expires: Never
$params = array(
'code' => '1234',
'client_id' => '492a34a0be1246c86de327d882cd77d8',
'client_secret' => 'c0dc2c9f5e3a102e6cf51f098e4d5dab',
'redirect_uri' => 'http://google.com',
'grant_type' => 'authorization_code',
);
$body = http_build_query($params);
$headers = array('Content-type' => 'application/x-www-form-urlencoded');
$request = new StdRequest('https://api.soundcloud.com/oauth2/token', 'POST', $headers, $body);
$client = new Client();
$response = $client->request($request);
// -------------------------------------------------------------------
Sends the following raw HTTP request (which is perfectly valid):
// -------------------------------------------------------------------
POST /oauth2/token HTTP/1.1
HOST: api.soundcloud.com
CONTENT-TYPE: application/x-www-form-urlencoded
USER-AGENT: Artax-Http/0.1 (PHP5.3+)
ACCEPT-ENCODING: gzip,deflate,identity
CONTENT-LENGTH: 166
code=1234&client_id=492a34a0be1246c86de327d882cd77d8&client_secret=c0dc2c9f5e3a102e6cf51f098e4d5dab&redirect_uri=http%3A%2F%2Fgoogle.com&grant_type=authorization_code