Skip to content

Instantly share code, notes, and snippets.

@psaia
Created March 9, 2012 19:52
Show Gist options
  • Save psaia/2008325 to your computer and use it in GitHub Desktop.
Save psaia/2008325 to your computer and use it in GitHub Desktop.
Easy way to share with Facebook
<?php
function show ($str)
{
$str = filter_var($str, FILTER_SANITIZE_STRING);
$str = str_replace('|', '#', $str);
echo ($str) ? $str : '';
}
?><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php show($_GET['title']); ?></title>
<meta property="og:title" content="<?php show($_GET['title']); ?>"/>
<meta property="og:url" content="<?php show($_GET['url']); ?>"/>
<meta property="og:image" content="<?php show($_GET['image']); ?>"/>
<meta property="og:site_name" content="<?php show($_GET['site_name']); ?>"/>
<meta property="og:type" content="<?php show($_GET['type']); ?>"/>
<meta property="og:description" content="<?php show($_GET['description']); ?>"/>
</head>
<body>
<script>
window.location = '<?php show($_GET['url']); ?>';
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment