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 7874087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:42:30+00:00 2026-06-03T02:42:30+00:00

I have a simple search bar, user types in a search terms and tweets

  • 0

I have a simple search bar, user types in a search terms and tweets that match the search terms should show up. However, it only works for single word searches.

<div id="search">
<form action="" method="get">
  <label>
  Search:
  <input type="text" name="search_box" id="search_box" />
  <input type="submit" name="submit" id="submit" value="Search" />
  </label>
</form>
</div>

<?php 


$q=$_GET['search_box'];

$search = "http://search.twitter.com/search.atom?q=".$q."";

$tw = curl_init();

curl_setopt($tw, CURLOPT_URL, $search);
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
$twi = curl_exec($tw);
$search_res = new SimpleXMLElement($twi);

echo "<h3>Twitter search results for '".$q."'</h3>";

foreach ($search_res->entry as $twit1) {

$description = $twit1->content;

$message = $row['content'];

echo "<div class='text'>".$description."</div><br><br>";

}

curl_close($tw);

?>
  • 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-03T02:42:31+00:00Added an answer on June 3, 2026 at 2:42 am

    If you’re searching with quotation marks for exact phrase matches then you need to escape these quotes before constructing your query string. With the current code:

    $q = $_GET['q']
    $search = "http://search.twitter.com/search.atom?q=".$q."";
    

    the input “test phrase” will result in this expression (which will probably cause a parse error):

    "http://search.twitter.com/search.atom?q="test phrase"";

    Instead, try urlencoding the user input before including it in the search string:

    $q = urlencode($_GET['q']);
    $search = "http://search.twitter.com/search.atom?q={$q}";
    

    Which should result in the value:

    http://search.twitter.com/search.atom?q=%22test%20phrase%22

    You can check that this works by entering the URL in your browser.

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

Sidebar

Related Questions

I have a simple search box that it hidden until hover(over) and hides again
I have a simple script that does some search and replace. This is basically
I have simple win service, that executes few tasks periodically. How should I pass
I have a site with content that is searchable using a search bar that
I have a simple url that will toggle one field in my search model.
I have a simple ChildWindow containing only two elements, textblock and a progress bar
We have a simple search on our site that uses MySQL fulltext search and
I have a simple WCF webservice client that sends a request to Microsoft Search
This should be simple, but I'm having trouble finding the search terms for it.
I have a simple search form with a box and a button. <form action

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.