I had to make a mad scramble to get all my Twitter feeds going again when API 1.0 was closed. It took a while but I managed to get the GET statuses/user_timeline working again. Now I'm attempting to use the search and I'm not being able to read the results. The JSON file is returning the correct data.
Here is my PHP code:
$code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/search/tweets'), array(
'q' => '%23'.$tagzname,
'since_id' => $num,
'lang' => 'en',
'count' => '2'));
$response = $tmhOAuth->response['response'];
var_dump(json_decode($response, true));
echo "<br><br><br><br>";
$json_output = json_decode($response, true);
foreach($json_output as $tweets) {
// $tmsgid = $tweets['statuses']['metadata']['id_str'];
$tmsgid = $tweets['statuses']['id_str'];
// $tmsgid = $tweets['metadata']['id_str'];
// $tmsgid = $tweets['id_str'];
echo 'Msg ID:' . $tmsgid . '<br>';
I just can't get the Msg ID output. What am I missing?
The JSON data looks like this:
array(2) {
["statuses"]=>
array(2) {
[0]=>
array(23) {
["metadata"]=>
array(2) {
["result_type"]=>
string(6) "recent"
["iso_language_code"]=>
string(2) "en"
}
["created_at"]=>
string(30) "Thu Jun 13 07:19:30 +0000 2013"
["id"]=>
float(3.4507795373608E+17)
["id_str"]=>
string(18) "345077953736081409"
...