<?php
require 'class.oembed_proxy.php';

# extend the providers, add Flickr
OEmbedProxy::$providers['flickr'] = array(
    'endpoint'  => 'http://www.flickr.com/services/oembed/',
    'url_regexp'    => 'flickr\\.com\\/photos\\/[-.\\w@]+\\/\\d+\\/?',
    // url example: "http://www.flickr.com/photos/fuffer2005/2435339994/"
    'title'         => 'Flickr');

$url = '';
if (isset($_GET['url']))
    $url = $_GET['url'];

$format = 'json';
if (isset($_GET['format']))
    $format = $_GET['format'];

if (empty($url)) {
    OEmbedProxy::setHttpStatus(403);
    exit;
}

$proxy = new OEmbedProxy($url, $format);

if (isset($_GET['maxwidth']))
    $proxy->setMaxWidth($_GET['maxwidth']);

if (isset($_GET['maxheight']))
    $proxy->setMaxHeight($_GET['maxheight']);

if (isset($_GET['callback']))
    $proxy->setJSCallback($_GET['callback']);

$proxy->forward();

?>