I want to access the new Twitter Stream API using Zend_Http_Client. The problem is that the HTTP request to this web page ( http://stream.twitter.com/1/statuses/sample.json ) never ends, but continues to load.
So even when I set Zend_Http_Client to setStream (), I cannot get the information that it sends.
This is what my logic 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");
Zend_Debug::dump($response);
flush();
ob_flush();
while(true)
{
echo fgets($response->getStream());
flush();
ob_flush();
}
Now, as soon as I run the query, I will never get to the while loop. What the Zend Framework does, it writes to a file.
The reason I want to use Zend_Http_Client is because I need to access this streaming API later using OAuth, and Zend_Oauth depends on Zend_Http_Client.
Any help would be greatly appreciated.