Hello,

This is because twitter renders the page differently for a browser the supports javascript (casperjs) versus one that does not (curl). Curl does not execute javascript, it only handles raw http requests and responses. Casperjs on the other hand is an interface to a GUI-less browser and executes events just like a browser.
Casperjs is based on PhantomJS & QT Webkit, so it is similar to Chrome. This means you can test any evaluate commands in a Chrome javascript console first. Oddly, in the case of your example I noticed the result for twitter on Chrome was still different than Casperjs. Caserpjs could not render the inner frames that contain the tweets.
To resolve this, you could use the mobile site, http://mobile.twitter.com/username
Cheers,
Graeme

发表回复