Jump to content

Search the Community

Showing results for tags 'twitter-api'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I was wondering if you could help me. I am currently trying to use the 'GET users/show' command in the Twitter API, however it is not working. Can anyone see where I am going wrong? <?php include "library/twitteroauth.php"; ?> <?php $consumer = "key"; $consumersecret = "key"; $accesstoken = "key"; $accesstokensecret = "key"; $twitter = new TwitterOAuth($consumer, $consumersecret, $accesstoken, $accesstokensecret); $tweets = $twitter->get('https://api.twitter.com/1.1/users/lookup.json?screen_name=twitterapi,twitter'); ?> <html> <head> <meta charset ="UTF-8" /> <title>Twitter Search</title> </head> <body> <form action="" method="post"> <label>Search: <input type="text" name ="keyword"/> </form> <?php if ( isset($_POST['keyword'])){ $tweets = $twitter->get('https://api.twitter.com/1.1/users/lookup.json?screen_name='.$_POST['keyword']. ''); foreach($tweets as $tweet){ foreach ($tweet as $t){ echo ($t->text); } } } ?> </body> </html>
  2. the two different api code for facebook, google + and twitter is located in three respective different folders , facebook folder for the facebook api , twitter folder for twitter and google_plus.. The thing is , I'm trying to make people be able to log through Twitter and access the application .. and give them the option to also logon through Facebook after logging through Twitter and keep the twitter-based data after they logged through Facebook , I would basically like them to be able to view both their twitter and facebook feeds and other data mixed together at the same time ... I tried to implement sessions , but it looks like if they log through Facebook after logging through twitter first , the Twitter session variable content become NULL and only facebook session data is displayed .. How can I manipulate the sessions so that twitter session data can be kept when a user log through facebook as well ? Below is what I did to test the data .. session_set_cookie_params('3600'); session_start(); require('../database/connection.php'); require_once('../twitter/twitteroauth/twitteroauth.php'); require_once('../twitter/config.php'); include_once '../facebook/fbmain.php'; // Here I'll test the $_SESSION variable to see if twitter data is kept after a user logs through facebook as well .. but twitter data become NULL instead and the $_SESSION array only show facebook data .. How can I make twitter session data STAY after someone logs through facebook as well ? var_dump($_SESSION); var_dump(session_id()); // twitter session data gets overriden by facebook data although the variable names are different .. /* If access tokens are not available redirect to connect page. */ if (empty($_SESSION['facebook_id']) && (empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret']))) { header('Location: ./clearsessions.php'); } else { /* Get user access tokens out of the session. */ $access_token = $_SESSION['access_token']; /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* If method is set change API call made. Test is called by default. */ $content = $connection->get('account/verify_credentials'); $json = json_encode($content); $data = json_decode($json,true); $screen_name = $data["screen_name"]; $name = $data["name"]; $image_url = $data['profile_image_url']; $_SESSION['screen_name'] = $screen_name; $_SESSION['image_url'] = $image_url; $query = "SELECT * FROM Users WHERE username ='$screen_name'"; $result = mysql_query($query); $result_count = mysql_num_rows($result); if($result_count == 0) { $insert = "INSERT INTO Users(username) VALUES('$screen_name')"; $result_insert = mysql_query($insert); } } if(isset($_SESSION['oauth_token']) && isset($_SESSION['oauth_token_secret']) && isset($_SESSION['facebook_id'])){ $user = $_SESSION['facebook_id']; } ?>
×
×
  • 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.