Jump to content

Php and Twitter


dropfaith

Recommended Posts

So i got the basis of this working here
what im trying to do is make it so it searches by not only username(complete) but also a certain hashtag (Duels)
And get it to display any media (photos)  in said tweet
 
 
<?php

require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "831981818408677377-FexWOmvCyaZYWt3TYwmodmx3gMmFIqx",
'oauth_access_token_secret' => "L1vwbaBjsUivKn5NYVmGgve6V1lSP5THvjBk3LiadHyOj",
'consumer_key' => "t31OianjtopHhDEdeBAjWPqj3",
'consumer_secret' => "zFZpwrMl31BShY6CluYapaZl0K1CQPpsagBjVCMkTs2GtWHhRm"
);
$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";

$requestMethod = "GET";
$getfield = 'screen_name=MCoCTrucos&count=1';
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);
if($string["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a             problem.</h3><p>Twitter returned the following error message:</p><p>     <em>".$string[errors][0]["message"]."</em></p>";exit();}
foreach($string as $items)
{
    echo "Tweeted by: ". $items['user']['name']."<br />";       
    echo "Screen name: ". $items['user']['screen_name']."<br />";
    echo "Tweet: ". $items['text']."<br />";        
    echo "Time and Date of Tweet: ".$items['created_at']."<br />";
    echo "Tweet ID: ".$items['id_str']."<br />";
    echo "Followers: ". $items['user']['followers_count']."<br /><hr />";
}
{
echo $url;}
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.