Fuel Documentation

Input Class

The input class allows you to access HTTP parameters, load server variables and user agent details.

cookie($index, $default = null)

The cookie method allows you to read $_COOKIE variables.

Static Yes
Parameters
Param Default Description
$index Required The key in the $_COOKIE array.
$default
null
What value should be returned if the array item is not found?
Returns mixed
Example
Input::cookie('foo', 'bar');

delete($index, $default = null)

The delete method allows you to read parameters from php://input stream when called via DELETE.

Static Yes
Parameters
Param Default Description
$index required The key in the php://input stream.
$default optional What value should be returned if the array item is not found?
Returns mixed
Example
Input::delete('foo', 'bar');

get($index, $default = null)

The get method allows you to read $_GET variables.

Static Yes
Parameters
Param Default Description
$index required The key in the $_GET array, or null for the entire array.
$default optional What value should be returned if the array item is not found?
Returns mixed
Example
Input::get('foo', 'bar');

post($index, $default = null)

The post method allows you to read $_POST variables.

Static Yes
Parameters
Param Default Description
$index required The key in the $_POST array, or null for the entire array.
$default optional What value should be returned if the array item is not found?
Returns mixed
Example
Input::post('foo', 'bar');

get_post($index, $default = null)

The get_post method allows you to read from $_GET and $_POST variables, checking $_GET first.

Static Yes
Parameters
Param Default Description
$index required The key in the $_GET or $_POST array.
$default optional What value should be returned if the array item is not found?
Returns mixed
Example
Input::get_post('foo', 'bar');

is_ajax()

The is_ajax method returns true if controller is called via AJAX.

Static Yes
Parameters None
Returns mixed
Example
Input::is_ajax(); // false

method()

The method method returns the HTTP method used to call the controller.

Static Yes
Parameters None
Returns string
Example
Input::method(); // "GET"

protocol()

The protocol method returns the HTTP protocol used to call the controller.

Static Yes
Parameters None
Returns string
Example
Input::protocol(); // "HTTP"

put($index, $default = null)

The put method allows you to read parameters from php://input stream when called via PUT.

Static Yes
Parameters
Param Default Description
$index required The key in the php://input stream.
$default optional What value should be returned if the array item is not found?
Returns mixed
Example
Input::put('foo', 'bar');

real_ip()

The real_ip method returns the IP address of the user.

Static Yes
Parameters None
Returns string
Example
echo Input::real_ip(); // 73.194.37.104

server($index, $default = null)

The server method allows you to read parameters from $_SERVER array with default values.

Static Yes
Parameters
Param Default Description
$index required The key in the $_SERVER array.
$default optional What value should be returned if the array item is not found?
Returns string
Example
Input::server('HTTP_HOST'); // "localhost:8080"