PHP Classes

Retrieving tweets

Recommend this page to a friend!

      Tweets from User Puller  >  All threads  >  Retrieving tweets  >  (Un) Subscribe thread alerts  
Subject:Retrieving tweets
Summary:Unknown error
Messages:3
Author:Darren Conyard
Date:2013-01-04 17:39:43
Update:2013-01-05 17:21:59
 

  1. Retrieving tweets   Reply   Report abuse  
Picture of Darren Conyard Darren Conyard - 2013-01-04 17:39:43
Hi Mikhail,

I thought this would be an interesting class and it is, the code is is compact and understandable even to a beginner like me. I thought I would attempt to list my own tweets in this script and For some reason it does not want to work.

I have tried manually entering the url into the address bar to retrieve the xml file and this works fine.

(http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=konyaruddo&count=10)

but when I remove the @ symbol from the function simplexml_load_file, I get the following error message:

Warning: simplexml_load_file(http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=Konyaruddo&count=10) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in .../get_twits.php on line 26

After some reading online, I think this is the API rejecting requests due to REST API Rate Limiting. source: https://dev.twitter.com/docs/rate-limiting

However I am not entirely sure if this is the case. If you can offer any advice on this it would be greatly appreciated.

Best Regards

Darren Conyard

  2. Re: Retrieving tweets   Reply   Report abuse  
Picture of Mikhail Mikhail - 2013-01-04 17:53:41 - In reply to message 1 from Darren Conyard
Hello,

Yes I think twitter does not accept your queries.
I have just checked for your twitter working perfect for me.


  3. Retrieving tweets   Reply   Report abuse  
Picture of Darren Conyard Darren Conyard - 2013-01-05 17:21:59 - In reply to message 2 from Mikhail
Hi,

I am still unable to load the tweets into the table.

The query I am using is:
api.twitter.com/1/statuses/user_tim ...

When I remove the @ symbol from simplexml_load_file, I copy and paste the url which is built from the query into an address bar on another tab and the xml file is there for me to view.

If I try using var_dump($twits) after the loading of the xml file bool(false) is printed on the web page.

I dont know if I am following the right here but on this link, http://php.net/manual/en/function.simplexml-load-file.php kannan writes that nodes that include ":" within them instead of "-" fail to load through the simplexml_load_file function.

It feels like I am going down the wrong road here, as it feels like this should work but maybe its a problem with my server. I am running PHP 5.2 on my server with allow_url_fopen enabled (I think this allows for external xml files to read).

If you can help me anymore with this that would be great, but maybe this is a specialised case and it may be too time consuming to debug!

Please get back to me with your thoughts on this.

Best Regards

Darren Conyard