bit dojo labs : file explorer

Inspecting: home > php > twitter-bookmarklet > twitter.php (download)
<?php
//
// Twitter Bookmarklet and Server Script
//
// This script uses bit.ly URL shortening service API
// You can get your API key at http://bit.ly/account/your_api_key
// 
// Bookmarklet:
// javascript:void(open('http://YOUR_SERVER/twitter.php?title='+encodeURI(document.title)+'&text='+encodeURI(document.selection?document.selection.createRange().text:(window.getSelection?window.getSelection():(document.getSelection?document.getSelection:'')))+'&url='+encodeURI(location.href),'t','width=562,height=210,top=30,left=30,resizable=1,scrollbars=0,status=0'))
//

    $bitly_user   = "&login=YOUR_API_USERNAME";
    $bitly_apikey = "&apiKey=YOUR_API_KEY";

    $bitly_api    = "http://api.bit.ly/shorten?version=2.0.1";
    $bitly_url    = "&longUrl=".$_GET["url"];

    $r1 = array('"'); 
    $r2 = array("'");
    $title = str_replace($r1,$r2,stripslashes(htmlspecialchars(urldecode($_GET["title"]))));
    $text = str_replace($r1,$r2,stripslashes(htmlspecialchars(urldecode($_GET["text"]))));

    $data = file_get_contents($bitly_api.$bitly_user.$bitly_apikey.$bitly_url);
    
    preg_match('/"shortUrl":\s"(.*)",/', $data, $res);
    
    $shorturl = $res[1];
    $status = "$title $shorturl $text";
?>

<html>
<head>
  <title>Twitter Submitter</title>
</head>
<body>
  <form name="twitter" id="twitter" method="get" action="http://twitter.com/home">
    <input type="hidden" name="status" value="<?php echo $status; ?>">
  </form>
  <script type="text/javascript">
    document.forms[0].submit();
  </script>
</body>