Note. I updated the library , so I suggest you use the new updated version before trying to do this - I did this so you do not need to manually encode each individual character.
This page shows you how to use the search, and has several operators down at the bottom of the page. One of them is the OR operator:
Getting Tweets for Multiple Users
OR - either this or that
love OR hate - containing either "love" or "hate" (or both)
From - from this user
from:twitterapi sent from the user @twitterapi
So, armed with the above knowledge, I assume that your request will look like this:
Translated to GET request:
?q=from:user1+OR+from:user2
Getting tweets for specific hashtags
So how do you get tweets for multiple users. The next step you want is certain hashtags.
#haiku - containing the hashtag "haiku"
What is individually translated into the correct format becomes:
?#haiku (or% 2C haiku, depending on the / urlencoding library used)
Combining above
The standard AND operator is as follows:
twitter search - containing both "twitter" and "search". Default operator
To request receipt:
?twitter+search
So let me combine all this!
?q=#hashtag1+#hashtag2+from:user1+OR+from:user2
And since you are using my lib , here is the code for this:
$url = 'https://api.twitter.com/1.1/search/tweets.json'; $requestMethod = 'GET'; $getfield = '?q=#hashtag1+OR+#hashtag2+from:username1+OR+from:username2'; $twitter = new TwitterAPIExchange($settings); $json = $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); var_dump(json_decode($json));