Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:
I'm grabbing data from a special Twitter firehose-type URL.
It will send information indefinitely*, so in order to manage the amount of data received by the script, it's recommended to use the maximum-time option.
Here's what I'm doing, a system() call containing:
/usr/bin/curl --request 'GET' 'https://stream.twitter.com/1.1/statuses/sample.json' --max-time 180 --header 'Authorization: $header'
Where $header is some OAuth magic.
So, is it possible to do this without the shell-out to curl and keep it all within Perl?
As far as I can see, that maximum time option isn't directly related to HTTP Headers, it's curl-specific.
* Updated to add documentation on this "indefinitely" thing. From the Twitter documentation::
To connect to the Streaming API, form a HTTP request and consume the resulting stream for as long as is practical. Our servers will hold the connection open indefinitely, barring server-side error, excessive client-side lag, network hiccups, routine server maintenance or duplicate logins.
|
|---|