<?php // nick // defferred page for making wordclouds require_once 'wordCloudMaker.php'; if (!isset($_POST['d'])) { die("!MISSING DATA ARG"); } if (empty($_POST['d'])) { die("!NO DATA"); } $json = unserialize(file_get_contents($_POST['d'])); echo generateWordCloud($json, 800, 800); unlink($_POST['d']);
</head> <body> <p>If you can see it, this works</p> <?php require_once 'wordCloudMaker.php'; /* $response = Unirest::post( "https://gatheringpoint-word-cloud-maker.p.mashape.com/index.php", array( "X-Mashape-Authorization" => "OkVWcztYb4IzHPzPd41C7uo1xWWaaB1s" ), array( "height" => 800, "textblock" => "yolo hello yolo swag what oh my god urban yolo swag urban outfitters hello there piano hello yolo swag urban", "width" => 800, "config" => "n\/a" ) ); */ $text = "yolo hello yolo swag what oh my god urban yolo swag urban outfitters hello there piano hello yolo swag urban"; echo generateWordCloud($text, 800, 800); ?> </body> </html>
$date2 = date('Y-m-d', strtotime($endDate)); $diff = abs(strtotime($date2) - strtotime($date1)); $totalDays = $diff / (60 * 60 * 24); $tweetsPerDay = number_format($totalTweets / $totalDays, 1); /** Find the percentage of tweets posted per day of the week **/ foreach ($daysOfWeek as &$day) { $day = number_format($day / $totalTweets * 100, 1); } /** Store the top five favorited tweets in topFavoritedTweets **/ foreach ($favoritedTweets as $tweetNum) { $date = $json[$tweetNum]["created_at"]; $fDate = date('F j, Y, g:ia', strtotime($date)); $topFavoritedTweets[] = array("text" => $json[$tweetNum]["text"], "created_at" => $fDate, "favorite_count" => $json[$tweetNum]["favorite_count"]); } /** Generate a word cloud **/ $wordCloudImage = generateWordCloud($json, 800, 800); /****** This is where we stop analyzing the stats ******/ /****** This is where we begin to display our analysis ******/ //echo "Judging from " . $query . "'s tweets from " . $f_beginDate . " to " . $f_endDate . "..." ; echo "In these " . number_format($totalDays, 0) . " days ..."; echo "<br><br>"; echo "Initial statistics: <br>"; echo $query . "makes " . $tweetsPerDay . " tweets per day.<br>"; echo $retweets . "% of " . $query . "'s tweets are retweets.<br>"; echo $replies . "% of " . $query . "'s tweets are replies.<br>"; echo $query . " used " . $hashtags . " hashtags and mentioned " . $userMentions . " users.<br>"; echo "<br>"; /** Display the top ten (or less) hashtags used **/ echo '<table>'; echo '<tr><td>Top Hashtags</td><td>Usage</td></tr>'; $count = 0;