Location: PHPKode > scripts > Request Data > request-data/example.basic.php
<?php
// Basic examples of use
require "request.class.php";

$request = new request();

$id = $request->get_int("id"); // Get the variable "id" from the $_REQUEST array as an integer, or, if it doesn't exist, return 0

$name = $request->get_string("name", "gp"); // Get the variable "name" from the $_POST array if it exist, if it doesn't exist, the $_GET array, or, if it exists in neither, return ""

$fullname = $request->get_string("fullname", "gp", "Smith"); // Same as above for the "fullname" variable, but return "Smith" if it is not found

$host = $request->get_string("HTTP_HOST", "s"); // Get the "HTTP_HOST" variable from the $_SERVER array.  See also the use of request::get_header() for HTTP headers through $_SERVER
?>
Return current item: Request Data