PAD Validator is a part of the PAD SDK package. It’s a PHP class that you can use in the scripts on your web site to validate PAD files.
The ZIP archive contains a required PHP library (the “includes” folder) and a sample validator script (validate.php).
With the PAD 4.0 specification update validation became easier for the download site operators. It is not only checks the XML structure validity but also verifies the data itself and offers a strong PAD-spam protection mechanism. Starting from the version 4.0 of the PAD specification, all PAD files have to be hosted in the official PAD repository. Each PAD in the Official PAD Repository gets validated and is manually verified by live operators. Basically, in order to validate a PAD file now, you just need to make 2 simple checks:
- Make sure that the actual URL of a PAD files matches the URL specified in the Application_XML_File_URL field.
- Make sure that PAD comes from an authorized source (the Official PAD Repository)
Below is a basic PAD validation code. Please use the validate.php code for real world applications.
//First, we create a PAD object and pass the URL of a PAD file that we need to validate $PAD = new PADFile($URL); //Loading PAD from URL $PAD->Load(); //Next, we create a Validator object and pass the URL of the current PAD specification $PADValidator = new PADValidator("http://repository.appvisor.com/padspec/files/padspec40.xml"); //Finally, we validate the PAD file against the current PAD specification $nErrors = $PADValidator->Validate($PAD); if ( $nErrors == 0 ) echo "The PAD file is valid"
Don’t hesitate to contact us should you have any questions regarding the On-Line PAD Validator code usage!