PHP getting Twitter API JSON file contents without OAuth (Almost have it)

Posted by DexCurl on Stack Overflow See other posts from Stack Overflow or by DexCurl
Published on 2011-02-18T10:36:11Z Indexed on 2011/02/18 23:25 UTC
Read the original article Hit count: 176

Filed under:
|
|
|
|

Hey guys, I have this script working fine with OAuth, but I accidentally nuked my 350 API hits with a stupid while statement :( I'm trying to get data from the Twitter API without OAuth, I can't figure it out (still pretty new), heres what I have

<html>
<body>
<center>
<hr />
<br />
<table border="1">
<tr><td>ScreenName</td><td>Followed back?</td></tr>
<?php
//twitter oauth deets
$consumerKey    = 'x';
$consumerSecret = 'x';
$oAuthToken     = 'x';
$oAuthSecret    = 'x';
// Create Twitter API objsect 
require_once("twitteroauth.php");
$oauth = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
//get home timeline tweets and it is stored as an array
$youfollow = $oauth->get('http://api.twitter.com/1/friends/ids.json?screen_name=lccountdown');
$i = 0;
//start loop to print our results cutely in a table
while ($i <= 20){
$youfollowid = $youfollow[$i];
$resolve = "http://api.twitter.com/1/friendships/exists.json?user_a=".$youfollow[$i]."&user_b=jwhelton";
$followbacktest = $oauth->get($resolve);
//$homedate= $hometimeline[$i]->created_at;
//$homescreenname = $hometimeline[$i]->user->screen_name;
echo "<tr><td>".$youfollowid."</td><td>".$followbacktest."</td></tr>";
$i++;
}
?>
</table>
</center>
</body>
</html>

Neither of the two Twitter functions require authentication, so how can I get the same results? Thanks guys, Dex

© Stack Overflow or respective owner

Related posts about php

Related posts about JSON