Is it better to display the latest tweets on a webpage using the PHP API or Javascript?

I want to display the user's last tweets on a web page, while still being able to erase tweets with custom CSS, and also maintain good page loading speed.

I managed to display the latest tweets in two ways.

  • Using PHP Twitter library (author Aaron Brazell). Using this method, my PHP code must wait for a response from Twitter before my page is completed and sent to the client. This can cause page load times to be very unpredictable and most likely slow down page loading in order to annoy users.

  • Using Blogger's Twitter Widget, the latest Tweets are loaded using JavaScript after loading the rest of the page. Thus, the user does not need to wait for a Twitter response before they can view the page.

I would like to know if there are any other pro and con to use these different methods to display the last tweets of the user, and also, if there is, possibly another solution that I can look into, which will include custom CSS style and provide good page loading performance?

Also, how do these 2 methods affect how Twitter applies speed limits? Using PHP, I can cache tweets and therefore make fewer Twitter calls using JavaScript, is that impossible, as far as I know?

+5
source share
8 answers

You can have custom CSS style in both directions, so this should not be a problem

  • when using PHP api, try to cache all the information you need and put it, for example. A database (and request twitter every 5-10 minutes or start updating the script via cron - since I last checked if there is a restriction on requests on Twitter that you can execute at a certain period of time)

  • Javascript , -, ( JS-...)

    /li >

, PHP- , ( , JavaScript script , )

Twitter

twitter.api: Twitter REST 150 / ( IP API)

GET , -, rest api

POST ,

http://twitter.com/account/rate_limit_status.format, ,

+10
  • Pro: . Con: - Twitter , + → ..

  • Pro: - . Con: JavaScript, Twitter, .

№1 .

+3

sweetcron. cron job. Twitter . twitter refrence pageload.

: http://code.google.com/p/sweetcron/

+1

- .

  • ? .
  • Google , , - .
0

:

(, 5 ) . , . , . , , JS ;)

, , , 5 .

JS, , , AJAX.

0

, .

PHP , , . RSS- Twitter PHP XML/DOM , , , .

JavaScript- , , JavaScript ().

0

, PHP, jQuery ( - ), , .

  • JavaScript
  • Google ( ?)
0

- , , , . PHP script, AJAX, Twitter - , , . <noscript> iFrame , Javascript!

I choose this method because it allows me to see the page very quickly, but they can still see tweets later.

0
source

All Articles