-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter-feed.php
49 lines (39 loc) · 1.58 KB
/
twitter-feed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php include("functions.php"); ?>
<html>
<title>IDidIt - Twitter</title>
<head>
<link href="styles/style.css" rel="stylesheet" type="text/css">
</head>
<script type="text/javascript" src="scripts/jquery.js"></script>
<body>
<div class="page">
<div class="content">
<?php include("Components/header.php"); ?>
<div class="main-content">
<h1>#ididit</h1>
<br><br><br>
<?php
require_once ("resources/api/twitter/twitteroauth.php");
require_once ('Private/creds.php');
$twitter = new TwitterOAuth($twitter_app_key, $twitter_app_secret, $twitter_oauth_key, $twitter_oauth_secret);
// The fetch url with the given username appended to it.
// $trends_url = "http://twitter.com/statuses/user_timeline/".$u.".xml";
$url = 'http://search.twitter.com/search.atom?q='.urlencode("#ididit");
$xml = $twitter->oAuthRequest($url, 'GET', array());
$affected = 0;
$twelement = new SimpleXMLElement($xml);
foreach ($twelement->entry as $entry) {
$text = trim($entry->title);
$author = trim($entry->author->name);
$time = strtotime($entry->published);
$id = $entry->id;
echo "<div class='tweet'>";
echo "<p>Tweet from ".$author.": <br><br><b>".$text."</b> <em><br>Posted ".date('n/j/y g:i a',$time)."</em></p>";
echo "</div>";
echo '<div class="space"></div>';
}
?>
<script type="text/javascript" src="scripts/functions.js"></script>
<?php include("Components/footer.php"); ?>
</body>
</html>