Skip to content

Instantly share code, notes, and snippets.

@clippit
Created April 18, 2012 08:34
Show Gist options
  • Save clippit/2412067 to your computer and use it in GitHub Desktop.
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
<?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