examples/whatsapp.php
private function cleanPostInputs()
    {
        $args = [
            'action'   => FILTER_SANITIZE_STRING,
            'password' => FILTER_SANITIZE_STRING,
            'from'     => FILTER_SANITIZE_STRING,
            'to'       => [
                'filter' => FILTER_SANITIZE_NUMBER_INT,
                'flags'  => FILTER_REQUIRE_ARRAY,
            ],
            'message'      => FILTER_UNSAFE_RAW,
            'image'        => FILTER_VALIDATE_URL,
            'audio'        => FILTER_VALIDATE_URL,
            'video'        => FILTER_VALIDATE_URL,
            'locationname' => FILTER_SANITIZE_STRING,
            'status'       => FILTER_SANITIZE_STRING,
            'userlat'      => FILTER_SANITIZE_STRING,
            'userlong'     => FILTER_SANITIZE_STRING,
        ];

        $myinputs = filter_input_array(INPUT_POST, $args);
        if (!$myinputs) {
            throw Exception('Problem Filtering the inputs');
        }

        return $myinputs;
    }
private function cleanPostInputs()
    {
        $args = [
            'action'   => FILTER_SANITIZE_STRING,
            'password' => FILTER_SANITIZE_STRING,
            'from'     => FILTER_SANITIZE_STRING,
            'to'       => [
                'filter' => FILTER_SANITIZE_NUMBER_INT,
                'flags'  => FILTER_REQUIRE_ARRAY,
            ],
            'message'      => FILTER_UNSAFE_RAW,
            'image'        => FILTER_VALIDATE_URL,
            'audio'        => FILTER_VALIDATE_URL,
            'video'        => FILTER_VALIDATE_URL,
            'locationname' => FILTER_SANITIZE_STRING,
            'status'       => FILTER_SANITIZE_STRING,
            'userlat'      => FILTER_SANITIZE_STRING,
            'userlong'     => FILTER_SANITIZE_STRING,
        ];

        $myinputs = filter_input_array(INPUT_POST, $args);
        if (!$myinputs) {
            throw Exception('Problem Filtering the inputs');
        }

        return $myinputs;
    }
private function cleanPostInputs ( ) { $ args = [ 'action' => FILTER_SANITIZE_STRING , 'password' => FILTER_SANITIZE_STRING , 'from' => FILTER_SANITIZE_STRING , 'to' => [ 'filter' => FILTER_SANITIZE_NUMBER_INT , 'flags' => FILTER_REQUIRE_ARRAY , ] , 'message' => FILTER_UNSAFE_RAW , 'image' => FILTER_VALIDATE_URL , 'audio' => FILTER_VALIDATE_URL , 'video' => FILTER_VALIDATE_URL , 'locationname' => FILTER_SANITIZE_STRING , 'status' => FILTER_SANITIZE_STRING , 'userlat' => FILTER_SANITIZE_STRING , 'userlong' => FILTER_SANITIZE_STRING , ] ; $ myinputs = filter_input_array ( INPUT_POST , $ args ) ; if ( ! $ myinputs ) { throw Exception ( 'Problem Filtering the inputs' ) ; } return $ myinputs ; }
Clean and Filter the inputted Form values.

This function attempts to clean and filter input values from
the form in the $_POST array. As nothing is currently put into
a database etc, this is probably not required, but it should help
if someone wishes to extend this project later.

@throws Exception If no $_POST values submitted.

@return array array with values that have been filtered.
Clean and Filter the inputted Form values .