* One of INPUT_GET, INPUT_POST, * INPUT_COOKIE, INPUT_SERVER, or * INPUT_ENV. * @param int $filter [optional]

* The ID of the filter to apply. The * manual page lists the available filters. *

* * @see filter_input() * * @return mixed */ function getRequest($name, $type = INPUT_POST, $filter = FILTER_SANITIZE_SPECIAL_CHARS) { switch ($type) { case INPUT_POST: default: if (!isset($_POST[$name])) { return null; } break; case INPUT_GET: if (!isset($_GET[$name])) { return null; } break; case INPUT_REQUEST: if (!isset($_REQUEST[$name])) { return null; } break; case INPUT_SESSION: if (!isset($_SESSION[$name]) || session_status() === PHP_SESSION_DISABLED || session_status() === PHP_SESSION_NONE) { return null; } break; case INPUT_COOKIE: if (!isset($_COOKIE[$name])) { return null; } break; } return filter_input($type, $name, $filter); } function sendPostData($url, $data) { // Initialize and get the curl handle $ch = curl_init(); // Include possible headers in the reply from the server as well curl_setopt($ch, CURLOPT_HEADER, true); // Return the reply as a string from curl_exec() instead of directly to stdout curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // The URI we want to send the post data to curl_setopt($ch, CURLOPT_URL, $url); // Use the POST method curl_setopt($ch, CURLOPT_POST, true); // All the data to be sent curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $reply = curl_exec($ch); curl_close($ch); return $reply; }