简体   繁体   中英

Twitter API 1.1 get tweets from multiple users

I know this have been asked several times. But none of the answers are helping me. I'm using the TwitterAPIExchange library and I'm using cakephp. Here is a bit of my code

$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?q=from:desertwinds09+OR+from:teffy0402&count=5';
$requestMethod = 'GET';

And thats it. But when I run it this is what I get:

{"statuses":[],"search_metadata":{"completed_in":0.005,"max_id":385960905676427264,"max_id_str":"385960905676427264","query":"from%3Adesertwinds09%2BOR%2Bfrom%3Ateffy0402","refresh_url":"?since_id=385960905676427264&q=from%3Adesertwinds09%2BOR%2Bfrom%3Ateffy0402&include_entities=1","count":5,"since_id":0,"since_id_str":"0"}}

And that just doesn't make sense. Is there anything wrong with my code?

Thanks in advance

Your issue is twofold.

Firstly, the user teffy0402 has their tweets protected. You can't access the tweets of someone with a protected account, unless you are the authenticating user who owns that account .

Try another user instead:

$getfield = '?q=from:desertwinds09+OR+from:nonprotectedaccount&count=5';

Secondly, the user desertwinds09 doesn't have any tweets since the id: 386093442759417856 .

You need to get the two individual parts working first before trying them together with an OR.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM