Module "validation"
Description
Available methods
- int validate_domain_name
- int validate_email
- int validate_fqdn
- int validate_ip
- int validate_nameservers
- int validate_phone
- int validate_url
- int validate_username
- int validate_vat
Details
int validate_domain_name
Validate a domain name of the form domain.tld
The supplied TLD must exist and the domain name must be in
compliance with the regulations for that specific TLD
Parameters
- string $domain_name The domain name to be validated
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_email
Validate an email address
This method used the PHP filter() function, in conjunction
with the FILTER_VALIDATE_EMAIL parameter.
Parameters
- string $email The email address to be validated
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_fqdn
Validate an FQDN [1] of the form subdomain.domain.tld
The supplied TLD must exist and the domain name must be in
compliance with the regulations for that specific TLD
The subdomain part is optional.
[1] http://en.wikipedia.org/wiki/Fully_qualified_domain_name
Parameters
- string $fqdn The FQDN
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_ip
Validate an ip address of the form 12.34.56.78
This method currently accepts IPv4-only addresses. As soon as
the API has full support for IPv6, an appropriate method will
be made available.
Parameters
- string $ip The IPv4 address to validate
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_nameservers
Validate nameservers for a domain name
This method will validate the nameserver for the supplied
domain name. If the TLD of the domain name requires that the
nameservers be authorative before they are applied, this will
be checked as well.
The supplied array should contain an array for each nameserver
which contains a key 'hostname' and optionally 'ip' if you need
glue records.
Example in PHP:
$nameservers = array (
0 => array (
'hostname' => 'ns1.example.com',
'ip4' => '192.0.2.101',
),
1 => array (
'hostname' => 'ns2.example.com',
'ip4' => '203.0.113.203',
'ip6' => '2001:db8::1',
),
2 => array (
'hostname' => 'ns1.example.net',
),
);
Parameters
- array $nameservers Array containing the namservers
- string $domain_name The domain name to validate the nameservers for
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_phone
Validate a phone number of the form +01.23456789
Parameters
- string $phone The phone number to be validated
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_url
Validate a URL of the form http://subdomain.domain.tld/
This method used the PHP filter() function, in conjunction
with the FILTER_VALIDATE_URL parameter.
Parameters
- string $url The URL to validate
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_username
Validate a username
The username can contain latin characters only: a-Z, 0-9
Parameters
- string $username The username to be validated
Returns
- int $valid 1 or 0, 1 is true, 0 is false
int validate_vat
Validate a VAT number
This will check the supplied VAT number against the European
database. For more information, see VIES [1].
Should VIES return a negative result, this method will try to
validate the VAT number against the Belgian national database
which also contains the numbers of Belgian VZW's and small
enterprises.
[1] http://ec.europa.eu/taxation_customs/vies/vieshome.do
[2] http://kbopub.economie.fgov.be/kbopub/zoekwoordenform.html?lang=nl
Parameters
- string $vat_number The VAT number to check
- int $country_id The country ID to chech the VAT number against
Returns
- int $valid 1 or 0, 1 is true, 0 is false