title: Passing arguments via POST with PHP/PECL OAuth extension
body: <p>I'm fairly new to the concept of OAuth and I'm trying to interact with the new Rdio API. I've managed to figure out the authentication using the PECL OAuth functions, but Rdio requires arguments to be passed in via POST and I can't figure out how that is done. The authentication works: the user is bounced to Rdio's site and asked to approve the application, and they are then returned to the site. After that, though, the request making calls to the API fails.</p>
  
  <p>Here's some info on the Rdio API: <a href="http://developer.rdio.com/docs/REST/" rel="nofollow">http://developer.rdio.com/docs/REST/</a></p>
  
  <p>Here's the code I have for authentication... the lines in italics are what I believe should make the call to the API requesting the method named "currentUser"</p>
  
  <pre><code>$req_url = 'http://api.rdio.com/oauth/request_token';
  $authurl = 'https://www.rdio.com/oauth/authorize';
  $acc_url = 'http://api.rdio.com/oauth/access_token';
  $callback = 'http://localhost/test.php';
  $api_url = 'http://api.rdio.com/1';
  $conskey = 'vmu7x6u4rk8vae8dn28h';
  $conssec = 'GrY7gF';
  
  session_start();
  
  if(!isset($_GET['oauth_token']) &amp;&amp; $_SESSION['state']==1) $_SESSION['state'] = 0;
  try {
    $oauth = new OAuth($conskey,$conssec,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
    $oauth-&gt;enableDebug();
    if(!isset($_GET['oauth_token']) &amp;&amp; !$_SESSION['state']) {
      $request_token_info = $oauth-&gt;getRequestToken($req_url);
      $_SESSION['secret'] = $request_token_info['oauth_token_secret'];
      $_SESSION['state'] = 1;
      header('Location: '.$authurl.'?oauth_token='.$request_token_info['oauth_token'].'&amp;oauth_callback='.urlencode($callback));
      exit;
    } else if($_SESSION['state']==1) {
      $oauth-&gt;setToken($_GET['oauth_token'],$_SESSION['secret']);
      $access_token_info = $oauth-&gt;getAccessToken($acc_url);
      $_SESSION['state'] = 2;
      $_SESSION['token'] = $access_token_info['oauth_token'];
      $_SESSION['secret'] = $access_token_info['oauth_token_secret'];
    } 
  
    $args = "method=currentUser";
  
    $oauth-&gt;setToken($_SESSION['token'],$_SESSION['secret']);
    $oauth-&gt;fetch("$api_url", $args);
    $json = json_decode($oauth-&gt;getLastResponse());
    print_r($json);
  
  } catch(OAuthException $E) {
    print_r($E);
  }
  </code></pre>
  
  <p>The message I get back:</p>
  
  <p><code>Warning: OAuth::fetch(http://api.rdio.com/1?oauth_consumer_key=vmu7x6u4rktv468vae8dn28h&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_nonce=12606272174d85622ad26ce8.80381248&amp;oauth_timestamp=1300587050&amp;oauth_version=1.0&amp;oauth_token=238zec5p4rpcpbfd8j36sjggz3jfsssybhxgcn9kvmmrmdxr3t4f2cnspt4dg5xf&amp;oauth_signature=1mZhJ9AUbi0sm6qhNaAntumAckU%3D) [function.OAuth-fetch]: failed to open stream: HTTP request failed! HTTP/1.0 596</code></p>
  
  <p>The problem is most likely that the arguments (method=currentUser) aren't being passed via POST properly. Does anyone have any idea how to do this using PECL's OAuth extensions?</p>