Hi, All! I have a problem with thmhOAuth.
Here is the code, it is like an example from
https://github.com/themattharris/tmhOAuth:
-------------------------------------------------------
require_once("config.php");
require_once("tmhOAuth.php");
require_once("functions.php");
function my_streaming_callback($data, $length, $metrics)
{
echo "\x0D\x0A Recieved: ".$data .PHP_EOL."\x0D\x0A";
return file_exists(dirname(__FILE__) . '/STOP');
}
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => CONSUMER_KEY,
'consumer_secret' => CONSUMER_SECRET,
'user_token' => OAUTH_TOKEN,
'user_secret' => OAUTH_TOKEN_SECRET,
));
$method = 'http://stream.twitter.com/1/statuses/filter.json';
// show Tweets which contan the word twitter OR have been geo-tagged
within
// the bounding box -122.41,37.77,-122.40,37.78 OR are by
themattharris
$params = array(
'track' => '@something,
// Around Twitter HQ. First param is the SW corner of the bounding
box
//'locations' => '-122.41,37.77,-122.40,37.78',
//'follow' => '106045630' // fb
);
$tmhOAuth->streaming_request('POST', $method, $params,
'my_streaming_callback');
$tmhOAuth->pr($tmhOAuth);
-----------------------------------------------------
Im starting this php script as backgrond process on linux, with output
to log file. I have noticed one strange thing, this process was
succesfully working for 23 hours,but then it was stopped. In my log
file i have found text, that was printed by method $tmhOAuth-
>pr($tmhOAuth):
<pre style="word-wrap: break-word">tmhOAuth Object
(
[params] => Array
(
)
[auto_fixed_time] =>
[config] => Array
(
[consumer_key] => xxxxxxxxxxxxxxxx
[consumer_secret] => xxxxxxxxxxxxxxxx
[user_token] => xxxxxxxxxxxxxxxxxxxxxxxx
[user_secret] => xxxxxxxxxxxxxxxxxxxxxxx
[use_ssl] => 1
[host] => api.twitter.com
[debug] =>
[force_nonce] =>
[nonce] => xxxxxxxxxxxxxxxxxxxxxxxxxx
[force_timestamp] =>
[timestamp] => 1292913341
[oauth_version] => 1.0
[curl_connecttimeout] => 30
[curl_timeout] => 10
[curl_ssl_verifypeer] =>
[curl_followlocation] =>
[is_streaming] => 1
[streaming_eol] =>
[streaming_metrics_interval] => 60
[streaming_callback] => my_streaming_callback
[multipart] =>
)
[metrics] => Array
(
[start] => 1292913341
[interval_start] => 1292987476
[tweets] => 2473
[last_tweets] => 2473
[bytes] => 8715
[last_bytes] => 8715
[tps] => 0.03
[bps] => 0
)
[method] => POST
[url] => http://stream.twitter.com/1/statuses/filter.json
[signing_params] =>
oauth_consumer_key=xxxxxxxxxxxxxxxxxxxx&oauth_nonce=xxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_signature_method=HMAC-
SHA1&oauth_timestamp=1292913341&oauth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_version=1.0&track=
%40something
[auth_params] => Array
(
[oauth_consumer_key] => iyaqddrf01Kyp6VsshlEg
[oauth_nonce] => xxxxxxxxxxxxxxxxxxxxxx
[oauth_signature] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[oauth_signature_method] => HMAC-SHA1
[oauth_timestamp] => 1292913341
[oauth_token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[oauth_version] => 1.0
)
[request_params] => track=%40something
[base_string] => POST&http%3A%2F%2Fstream.twitter.com
%2F1%2Fstatuses%2Ffilter.json&oauth_consumer_key%xxxxxxxxxxxxxxxxxxxxxx
%26oauth_nonce%xxxxxxxxxxxxxxxxxxxxx%26oauth_signature_method%3DHMAC-
SHA1%26oauth_timestamp%3D1292913341%26oauth_token
%xxxxxxxxxxxxxxxxxxxxxx%26oauth_version%3D1.0%26track%3D%2540something
[signing_key] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[headers] => Array
(
[0] => Authorization: OAuth
oauth_consumer_key="xxxxxxxxxxxxxxxxxx",
oauth_nonce="xxxxxxxxxxxxxxxxxxxxxxx",
oauth_signature="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1292913341",
oauth_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", oauth_version="1.0"
[1] => Expect:
)
[auth_header] => OAuth oauth_consumer_key="iyaqddrf01Kyp6VsshlEg",
oauth_nonce="xxxxxxxxxxxxxxxxxxxxx",
oauth_signature="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1292913341",
oauth_token="xxxxxxxxxxxxxxxxxxxxxxxxxxx", oauth_version="1.0"
[response] => Array
(
[content-length] => 0
[headers] => Array
(
[content_type] => application/json
[transfer_encoding] => chunked
[server] => Jetty(6.1.25)
)
[code] => 200
[response] => 1
[info] => Array
(
[url] => http://stream.twitter.com/1/statuses/filter.json
[content_type] => application/json
[http_code] => 200
[header_size] => 102
[request_size] => 532
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 74146.904694
[namelookup_time] => 0.014185
[connect_time] => 0.079979
[pretransfer_time] => 0.080045
[size_upload] => 22
[size_download] => 13661
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 30.157485
[redirect_time] => 0
[request_header] => POST /1/statuses/filter.json
HTTP/1.1
User-Agent: themattharris' HTTP Client
Host: stream.twitter.com
Accept: */*
Authorization: OAuth oauth_consumer_key="xxxxxxxxxxxxxxxx",
oauth_nonce="xxxxxxxxxxxxxxxxx", oauth_signature="xxxxxxxxxxxxxxxx",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1292913341",
oauth_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", oauth_version="1.0"
Content-Length: 22
Content-Type: application/x-www-form-urlencoded
)
)
[buffer] =>
)
------------------------------
My question is- why it was stopped? And how to solve this problem?
--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
http://groups.google.com/group/twitter-development-talk