Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8718307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:30:43+00:00 2026-06-13T06:30:43+00:00

I am using twitters search API to view all the tweets that use a

  • 0

I am using twitters search API to view all the tweets that use a particular hashtag I want to view.

However, I want to use the stream function, so, I only get recent ones, and so, I can then store them.

  <?php
        global $total, $hashtag;
        $hashtag = $_POST['hash'];
        $total = 0;
        function getTweets($hash_tag, $page) {
              global $total, $hashtag;
              $url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&';
              $url .= 'page='.$page;    
              $ch = curl_init($url);
              curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
              $json = curl_exec ($ch);
              curl_close ($ch);
              echo "<pre>";    
              $json_decode = json_decode($json);
              print_r($json_decode->results);

              $json_decode = json_decode($json);        
              $total += count($json_decode->results);    
              if($json_decode->next_page){
                   $temp = explode("&",$json_decode->next_page);        
                   $p = explode("=",$temp[0]);                
                   getTweets($hashtag,$p[1]);
              }        
        }

        getTweets($hashtag,1);
        echo $total;
  ?>

The above code is what I have been using to search for the tweets I want.

What do I need to do to change it so I can stream the tweets instead?

I know I would have to use the stream url https://api.twitter.com/1.1/search/tweets.json ,
but what do I need to change after that is where I don’t know what to do.

Obviously, I know I’ll need to write the database sql but I want to just capture the stream first and view it.

How would I do this? Is the code I have been using not any good for just capturing the stream?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:30:44+00:00Added an answer on June 13, 2026 at 6:30 am

    It seems to be impossible to use the stream API to get hashtags.

    Using the search API is pretty much the only solution. Just use an AJAX content refresh to get all new tweets. The overall effect is pretty much the same unless you want to store the tweets in a database in which case to have to prevent duplicates being save.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MGtwitterengine in iPhone , I want to use USER search API
I am using java with the twitter search api to store tweets in mongoDB,
I am new to facebook api. I want to search for a particular word
I'm using the Twitter API atom format http://search.twitter.com/search.atom?lang=en&q=some_hashtag but it's return me tweets with
I've been using the Twitter search api and PHP to pull in tweets from
Are you allowed to locally store tweets obtained using the twitter api? http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search
all I want to display youtube subscriber using its api. But not able to
Using Twitter's search API, I'm being returned a helluva lot of information that is
I am using twitter search api https://dev.twitter.com/docs/using-search I want to search for a word
I'm importing some tweets using the Search API and get the returning JSON: results:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.