protected function validateRequest()
    {
        //Twilio requires that all POST data be sorted alpha to validate.
        $data = $_POST;
        ksort($data);

        // append the data array to the url string, with no delimiters
        $url = $this->url;
        foreach ($data as $key => $value) {
            $url = $url.$key.$value;
        }

        //Encode the request string
        $hmac = hash_hmac('sha1', $url, $this->authToken, true);

        //Verify it against the given Twilio key
        if (base64_encode($hmac) != $_SERVER['HTTP_X_TWILIO_SIGNATURE']) {
            throw new \InvalidArgumentException('This request was not able to verify it came from Twilio.');
        }
    }
protected function validateRequest()
    {
        //Twilio requires that all POST data be sorted alpha to validate.
        $data = $_POST;
        ksort($data);

        // append the data array to the url string, with no delimiters
        $url = $this->url;
        foreach ($data as $key => $value) {
            $url = $url.$key.$value;
        }

        //Encode the request string
        $hmac = hash_hmac('sha1', $url, $this->authToken, true);

        //Verify it against the given Twilio key
        if (base64_encode($hmac) != $_SERVER['HTTP_X_TWILIO_SIGNATURE']) {
            throw new \InvalidArgumentException('This request was not able to verify it came from Twilio.');
        }
    }
protected function validateRequest ( ) { //Twilio requires that all POST data be sorted alpha to validate. $ data = $ _POST ; ksort ( $ data ) ; // append the data array to the url string, with no delimiters $ url = $ this -> url ; foreach ( $ data as $ key => $ value ) { $ url = $ url . $ key . $ value ; } //Encode the request string $ hmac = hash_hmac ( 'sha1' , $ url , $ this -> authToken , true ) ; //Verify it against the given Twilio key if ( base64_encode ( $ hmac ) != $ _SERVER [ 'HTTP_X_TWILIO_SIGNATURE' ] ) { throw new \ InvalidArgumentException ( 'This request was not able to verify it came from Twilio.' ) ; } }
Checks if a message is authentic from Twilio.

@throws \InvalidArgumentException
Checks if a message is authentic from Twilio .