info343/lectures/json-web-services/exponent.php

<?php
   if (!isset($_REQUEST['base']) || !isset($_REQUEST['exponent'])) {
      header("HTTP/1.1 400 Bad Request");
      header("Content-type: text/plain");
      echo "Error: you must pass both 'base' and 'exponent' parameters.";
   } else {
      header("Content-type: text/plain");
      $base = $_REQUEST["base"];
      $exp = $_REQUEST["exponent"];
      $result = pow($base, $exp);
      print $result;
   }
?>