Skip to content

Instantly share code, notes, and snippets.

@co3k
Created February 17, 2010 05:43
Show Gist options
  • Save co3k/306341 to your computer and use it in GitHub Desktop.
Save co3k/306341 to your computer and use it in GitHub Desktop.
<?php
$uri = str_replace('Chiara_PEAR_Server_REST', 'pluginRest', $_SERVER['REQUEST_URI']);
if ('GET' === strtoupper($_SERVER['REQUEST_METHOD']))
{
$ch = curl_init('http://plugins.teriyaki.jp'.$uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$head = trim(curl_exec($ch));
curl_close($ch);
$headers = array();
$lines = explode('<br />', nl2br(trim($head)));
foreach ($lines as $line)
{
header(trim($line));
}
echo $body;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment