Skip to content

Instantly share code, notes, and snippets.

Last active May 15, 2017 11:35
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
ローカルでFileMaker Data APIを使って開発する際に利用するPHPのビルトインサーバー用ルータースクリプト
$url = "" . $_SERVER['REQUEST_URI'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
if (in_array($_SERVER['REQUEST_METHOD'], array('PUT', 'DELETE'))) {
if (in_array($_SERVER['REQUEST_METHOD'], array('POST', 'PUT'))) {
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents("php://input"));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: ' . $_SERVER['CONTENT_TYPE'],
'X-Forwarded-For: ' . $_SERVER['REMOTE_ADDR'],
'FM-Data-token: ' . $_SERVER['HTTP_FM_DATA_TOKEN'],
$html = curl_exec($ch);
echo $html;
Copy link

msyk commented May 15, 2017

I modified for avoiding "Undefined index" warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment