1 <?php
//When called, make a request to pull a tweet from an SQL table
2 require_once("../class/board-level-database-connection.php");
3 $db_connection = new BoardLevelDatabaseConnection("../");
5 $unposted_tweets = $db_connection->getAllUnposted();
7 echo "<br/>" . var_dump($unposted_tweets);
10 require_once("../class/twitter-connection.php");
12 $tw_connection = new TwitterConnection("../");
13 foreach($unposted_tweets as $tweet){
14 $response = $tw_connection->makeTweet($tweet["PostText"], explode(",", $tweet["ImageURL"]));
18 if($response["created_at"] === null){
19 echo "post unsuccessful ";
20 echo($response["errors"][0]["code"]);
21 $db_connection->updatePost("Unsubmitted", "PostID", $tweet["PostID"],
22 array('Unverified'=>$response["errors"][0]["code"]));
25 $db_connection->deleteFromTable("Tweet", "PostID", $tweet["PostID"]); //might be 0
26 echo "Found, Added and Deleted<br/>";