par
moogli » 29 juin 2016, 12:31
salut,
ton script devrait ressembler à cela
<?php
$caseForVerif = ['.net' => 7, '.com' => 7, '.org' => 0, '.fr' => 13, '.ca' => 5, '.info' => 0, '.biz' => 1, '.de' => 45, '.eu' => 50, '.me.uk' => 30, '.co.uk' => 30, '.org.uk' => 40];
$strForVerif = ['.com' => 'No match for %s".', 'fr' => '%%%% No entries found in the AFNIC Database.', 'net' => 'No match for %s".', 'org' => 'NOT FOUND', 'ca' => '', 'info' => 'NOT FOUND', 'biz' => '', 'de' => '', 'eu' => '', 'me.uk' => '', 'co.uk' => '', 'org.uk' => ''];
$ndds = file('liste_ndd.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$result = '';
foreach ($ndds as $ndd) {
if (!empty($theNdd)) {
$theNdd = escapeshellcmd($ndd);
$myArray = '';
$anExt = substr($theNdd, strrpos($theNdd, '.'));
$anExt = escapeshellcmd($anExt);
exec('whois '.$theNdd, $myArray);
$result .= '->> '.$theNdd;
if ((strtolower($myArray[$caseForVerif[$anExt]]) == sprintf(strtolower($strForVerif[$anExt])))) {
$result .= 'est libre';
} else {
$result .= 'est déjà réservé';
}
echo '<h3>' , str_replace('\\', '', $result) , '</h3';
}
}
j'ai pas testé, j'ai juste 'optimisé' l'utilisation des tableaux, supprimer les trucs 'inutiles' et utilisé seulement le ndd fournit sur chaque ligne du fichier.
Le fichier doit contenir un ndd par ligne
par exemple
phpfrance.com
www.phpfrance.com
phpfrance.fr
www.phpfrance.fr
etc..
@+
salut,
ton script devrait ressembler à cela
[php]<?php
$caseForVerif = ['.net' => 7, '.com' => 7, '.org' => 0, '.fr' => 13, '.ca' => 5, '.info' => 0, '.biz' => 1, '.de' => 45, '.eu' => 50, '.me.uk' => 30, '.co.uk' => 30, '.org.uk' => 40];
$strForVerif = ['.com' => 'No match for %s".', 'fr' => '%%%% No entries found in the AFNIC Database.', 'net' => 'No match for %s".', 'org' => 'NOT FOUND', 'ca' => '', 'info' => 'NOT FOUND', 'biz' => '', 'de' => '', 'eu' => '', 'me.uk' => '', 'co.uk' => '', 'org.uk' => ''];
$ndds = file('liste_ndd.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$result = '';
foreach ($ndds as $ndd) {
if (!empty($theNdd)) {
$theNdd = escapeshellcmd($ndd);
$myArray = '';
$anExt = substr($theNdd, strrpos($theNdd, '.'));
$anExt = escapeshellcmd($anExt);
exec('whois '.$theNdd, $myArray);
$result .= '->> '.$theNdd;
if ((strtolower($myArray[$caseForVerif[$anExt]]) == sprintf(strtolower($strForVerif[$anExt])))) {
$result .= 'est libre';
} else {
$result .= 'est déjà réservé';
}
echo '<h3>' , str_replace('\\', '', $result) , '</h3';
}
}[/php]
j'ai pas testé, j'ai juste 'optimisé' l'utilisation des tableaux, supprimer les trucs 'inutiles' et utilisé seulement le ndd fournit sur chaque ligne du fichier.
Le fichier doit contenir un ndd par ligne
par exemple
phpfrance.com
www.phpfrance.com
phpfrance.fr
www.phpfrance.fr
etc..
@+