Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing the Twitter API via PHP
    primarykey
    data
    text
    <p>I'm working on making my script mesh with OAuth instead of Basic Auth, and I'm stuck. So far, I'm just working on authenticating at the moment, but I can't get that working. This code:</p> <pre><code>&lt;?php include 'config.php'; include 'twitteroauth/twitteroauth.php'; // Use config.php credentials $conn = new TwitterOAuth(CONSUMER_KEY,CONSUMER_SECRET); // Use application's registered callback URL // And get temporary credentials using made connection $tempCred = $conn-&gt;getRequestToken(); // Use 'Sign in with Twitter' // for Redirect URL $rURL = $conn-&gt;getAuthorizeURL($tempCred); echo '&lt;a href="'.$rURL.'"&gt;1. Click me first!&lt;/a&gt;&lt;br /&gt;'; </code></pre> <p>works just fine. However, when I make it to this step:</p> <pre><code> // Build a new TwitterOAuth connection // Now that the app has verified credentials $conn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); // Get non-temporary credentials from Twitter $tokenCred = $conn-&gt;getAccessToken(); echo '&lt;a href="index.php"&gt;2. Click me next!&lt;/a&gt;&lt;br /&gt;'; ?&gt; </code></pre> <p>I get a Page Not Available, <code>Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error</code>. Is anyone familiar with this issue? I was following the documentation as closely as I could, but as I am a complete rookie I'm sure I made some stupid mistake.</p> <p>Also, a follow up question: Once I do get my script authorizes via this process, what is my next step in terms of grabbing the friends feed <code>xml</code>? Can I just <code>cURL</code> it like before?</p> <p>EDIT: The source for <code>getAccessToken();</code> is as follows:</p> <pre><code> function getAccessToken($oauth_verifier = FALSE) { $parameters = array(); if (!empty($oauth_verifier)) { $parameters['oauth_verifier'] = $oauth_verifier; } $request = $this-&gt;oAuthRequest($this-&gt;accessTokenURL(), 'GET', $parameters); $token = OAuthUtil::parse_parameters($request); $this-&gt;token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); return $token; } </code></pre> <p>And yes, config.php is correct.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload