THRIFT-405. php: Create a tutorial server


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758528 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tutorial/php/PhpClient.php b/tutorial/php/PhpClient.php
index dc36f6d..ab38c11 100755
--- a/tutorial/php/PhpClient.php
+++ b/tutorial/php/PhpClient.php
@@ -6,6 +6,7 @@
 require_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
 require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
 require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
+require_once $GLOBALS['THRIFT_ROOT'].'/transport/THttpClient.php';
 require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
 
 /**
@@ -25,7 +26,11 @@
 error_reporting(E_ALL);
 
 try {
-  $socket = new TSocket('localhost', 9090);
+  if (array_search('--http', $argv)) {
+    $socket = new THttpClient('localhost', 8080, '/php/PhpServer.php');
+  } else {
+    $socket = new TSocket('localhost', 9090);
+  }
   $transport = new TBufferedTransport($socket, 1024, 1024);
   $protocol = new TBinaryProtocol($transport);
   $client = new CalculatorClient($protocol);