Last active
August 29, 2015 14:21
-
-
Save mikestratton/4321f99060a70de76e10 to your computer and use it in GitHub Desktop.
Queries twitter using specific keyword and posts most recent 100 tweets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Queries twitter using specific keyword and posts most recent 100 tweets | |
error_reporting(E_ERROR); | |
$json = file_get_contents("http://mikestratton.net/temp/bigdatabox/src/raw_twitter_Lebron_James.php"); | |
$t_query = json_decode($json,true); | |
$query = $t_query ['search_metadata']['query']; | |
echo "<h1>Users Tweeting About: ".$query." </h1>"; | |
reset($t_query); | |
foreach ($t_query as $key => $value) { | |
// echo "Key: $key; Value: $value<br />\n"; | |
foreach ($value as $key2 => $value2){ | |
// echo "Key2: $key2; Value2: $value2<br />\n"; | |
foreach ($value2 as $key3 => $value3){ | |
// echo "Key3: $key3; Value3: $value3<br />\n"; | |
if ($key3 == "text"){ | |
// echo "Text Values: $value3<br />\n"; | |
$text = $value3; | |
} | |
foreach ($value3 as $key4 => $value4){ | |
// echo "Key4: $key4; Value4: $value4<br />\n"; | |
if ($key4 == "name"){ | |
echo "User: $value4<br />\n"; | |
echo "Tweet: $text<br />\n"; | |
echo "<br />"; | |
} | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment