App Directory >> CakePHP Validation + Set + HTTP Socket by Diogo Resende
CakePHP Validation + Set + HTTP Socket
This is the CakePHP Validation, Set and HTTP Socket libraries updated to PHP5 syntax for Vork.Cake Validation
This class is used to check if a variable content validates against a restriction you want. You can check if a variable has an IP address, a URL, and e-mail address, a numeric value, etc.
$validator = get::component('validation');
if ($validator->between($num, 5, 10)) {
printf("The number %d is between 5 and 10.", $num);
}
Cake Set
This class can be used to perform several operations with lists (arrays).
$set = get::component('set')
if (!$set->numeric(array(1, 2, 3, 'a', 5))) {
printf("The list is not numeric. There are some non-numeric members\n");
}
Cake HTTP Socket
This class can be used to connect to an HTTP server and push/pull data from it using GET/POST/PUT/DELETE/...
$socket = get::component('httpSocket');
$data = $socket->get('http://www.google.com');
// $data will now have google.com page content
For a complete list of features, check the CakePHP documentation about these classes.
App Files
- mvc
- components