Created
April 18, 2012 08:34
-
-
Save clippit/2412067 to your computer and use it in GitHub Desktop.
A tiny Twitter proxy for reading your timeline from Octopress aside. F**k G-F-W
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 | |
if (strpos($_SERVER['HTTP_REFERER'], "dayanjia.com") === FALSE) { | |
header('HTTP/1.1 403 Forbidden'); | |
die("Unauthorized access forbidden!"); | |
} | |
header('Content-Type: application/json; charset=utf-8'); | |
$user = $_GET['user']; | |
$count = $_GET['count']; | |
$replies = $_GET['exclude_replies']; | |
$callback = $_GET['callback']; | |
$url = "http://api.twitter.com/1/statuses/user_timeline/${user}.json?trim_user=true&count=${count}&include_entities=1&exclude_replies=${replies}"; | |
$data = file_get_contents($url); | |
if (!$data) { | |
header('HTTP/1.1 503 Service Unavailable'); | |
exit(); | |
} | |
echo "$callback($data)"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment