Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A way for remote tile drawers to call home

  • Loading branch information...
commit 68f731e64401a9aa6df42f3096f1eca4eab467f1 1 parent a1c3d60
Michal Migurski authored
Showing with 33 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +9 −0 Makefile
  3. +23 −0 phonehome.php
View
1  .gitignore
@@ -0,0 +1 @@
+calls
View
9 Makefile
@@ -0,0 +1,9 @@
+all: calls
+ #
+
+calls:
+ mkdir calls
+ chmod a+rwX calls
+
+clean:
+ rm -rf calls
View
23 phonehome.php
@@ -0,0 +1,23 @@
+<?php
+
+ $headers = getallheaders();
+ $stated_length = $headers['Content-Length'];
+ $call_filename = sprintf('%s/calls/%s-%s.txt', dirname(__FILE__), $_SERVER['REMOTE_ADDR'], uniqid());
+
+ $call = @fopen($call_filename, 'w');
+ $stdin = @fopen('php://input', 'r');
+
+ if(is_numeric($stated_length) && $call && $stdin)
+ {
+ fwrite($call, fread($stdin, intval($stated_length)));
+ fclose($call);
+ chmod($call_filename, 0666);
+
+ header('HTTP/1.1 201');
+ die("OK\n");
+ }
+
+ header('HTTP/1.1 500');
+ die("*thunk*\n");
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.