title: Writing library for Twitter, where am I going wrong?
body: <p>I'm writing a library to connect to Twitter that uses <a href="http://requests.ryanmccue.info/" rel="nofollow">Requests for PHP</a>. I'm not sure, but I don't think that I'm building the OAuth correctly because I can't authenticate. I've double-checked it, and checked it against another existing library but still can't seem to get it right.</p>
  
  <p>The code is <a href="https://raw.github.com/hassankhan/resyted-backend-php/master/library/Resyted/Service/OAuth1AService.php" rel="nofollow">here</a>.</p>
  
  <p>The idea is you instantiate the service, send it config parameters, and before it does the request, it generates the <code>'Authorization: OAuth xxx'</code> header and adds it to said request.</p>
  
  <pre><code>$twitter = array(
      'consumer_key'        =&gt; '',
      'consumer_secret'     =&gt; '',
      'access_token'        =&gt; '',
      'access_token_secret' =&gt; '',
      'screen_name'         =&gt; '_hassankhan',
      'api_url'             =&gt; 'https://api.twitter.com/1.1/'
  );
  
  $service = new OAuth1AService('Twitter', $twitter['api_url']);
  $service-&gt;config($twitter);
  $service-&gt;doGet(
      'statuses/user_timeline.json',
      array(
          'screen_name'      =&gt; '_hassankhan',
          'include_entities' =&gt; 'true'
      ),
      array(),
      'raw'
  );
  print($service-&gt;getResult());
  </code></pre>