Functions

This page describe all functions available into your PHP scripts for php-clamav.

cl_info()

Returns informations about ClamAV (version and signatures loaded).

Syntax:

                cl_info();
            

Returns:

  • (string) Returns a text line with ClamAV informations in english.

Example:

                $ret = cl_info();
                echo $ret;
            


cl_debug()

Turn on debug information.

Syntax:

                cl_debug();
            


cl_scanfile()

Scan a file given a filename, returns the virusname and return code of the 'cl_scanfile()' API function.

Syntax:

                cl_scanfile(string filename, string virusname);
            

Arguments:

  1. filename : the absolute / relative path to the file.
  2. virusname : This parameter is used to retrieve the virusname if a virus was found.

Returns:

  • (int) Return a result code from ClamAV scan.

Example:

                $retcode = cl_scanfile($file, $virusname);
                if ($retcode == CL_VIRUS) {
                    echo "File path : ".$file."Return code : ".cl_pretcode($retcode)."Virus found name : ".$virusname; 
                } else {
                    echo "File path : ".$file."Return code : ".cl_pretcode($retcode); 
                }
            

See also:



cl_pretcode()

Translates the ClamAV return code to a human readable description.

Syntax:

                cl_pretcode(int retcode);
            

Arguments:

  1. retcode : The return code number from cl_scanfile.

Returns:

  • (string) Returns a string with the return code description in english.

Example:

                $ret = cl_pretcode(CL_VIRUS);
                echo $ret;
            

See also: