Newer
Older
Zirror-API / docroot / include / http / Request.php
@Christopher W. Olsen Christopher W. Olsen on 31 May 2019 611 bytes Whoa
<?php

class ZirrorAPI_Request {

  private $rData;

  private $rawData;

  function __construct() {

    $rMethod = isset ( $_SERVER ['REQUEST_METHOD'] ) ? $_SERVER ['REQUEST_METHOD'] : "FAIL";

    switch ($rMethod) {
      case 'POST' :
        $this->rawData = file_get_contents ( "php://input" );
        break;
      default :
        Header ( "Location: http://www.Zirror.com" );
        exit ( 0 );
    }

    $this->rData = json_decode ( $this->rawData );

  }

  function get($key) {

    if (! isset ( $this->rData->$key )) {
      return false;
    } else
      return $this->rData->$key;

  }

}
?>