I want to access the new Twitter Stream API using Zend_Http_Client. The problem is, that the HTTP request to that web page (http://stream.twitter.com/1/statuses/sample.json) is never finished but keeps loading.
So even when I set Zend_Http_Client to setStream(), I can't get the information it sends out.
This is what my logic currently looks like:
$httpClient = new Zend_Http_Client("http://stream.twitter.com/1/statuses/sample.json");
$httpClient->setAuth("username", "password");
$httpClient->setStream("/tmp/twitter_stream");
flush();
ob_flush();
$response = $httpClient->request("GET");
// Never get here... :(
Zend_Debug::dump($response);
flush();
ob_flush();
while(true)
{
echo fgets($response->getStream());
flush();
ob_flush();
}
Now, once I start the request, I never get to the while loop. What the Zend Framework does is, it writes into a file.
The reason why I want to use Zend_Http_Client is, because I later have to access that Stream API using OAuth, and Zend_Oauth relies on Zend_Http_Client.
Any help would be greatly appreciated.