Disponibilité d'un nom de domaine xxx.com
David
-
David -
David -
Bonjour,
Windows XP / Firefox 6.0.2
Mac Os , DW CS4 / CS5.
Langage : Php4 / Base de données : Mysql
je suis un programmeur débutant, Dans mon sujet de stage ils m'ont demandé de créer une application Web pour vérifier si un nom de domaine de type XXXX.com est disponible ou pas.
Il y a pas mal des sites web qui propose ce service comme : http://www.whois.net/ et d'autres. Mais je dois créer une application qui fait même chose et je ne sais pas par quoi commencer !!
Dans l'attente de vos idées.
Merci d'avance.
Windows XP / Firefox 6.0.2
Mac Os , DW CS4 / CS5.
Langage : Php4 / Base de données : Mysql
je suis un programmeur débutant, Dans mon sujet de stage ils m'ont demandé de créer une application Web pour vérifier si un nom de domaine de type XXXX.com est disponible ou pas.
Il y a pas mal des sites web qui propose ce service comme : http://www.whois.net/ et d'autres. Mais je dois créer une application qui fait même chose et je ne sais pas par quoi commencer !!
Dans l'attente de vos idées.
Merci d'avance.
A voir également:
- Waptrick xxx
- Xxx com - Meilleures réponses
- Waptrick com xxx - Meilleures réponses
- Waptrick xxx.com - Télécharger - Divers TV & Vidéo
- Nom de compte steam exemple - Forum Jeux vidéo
- Trouver un nom avec une adresse ✓ - Forum Loisirs / Divertissements
- Nom de l'adresse ✓ - Forum Loisirs / Divertissements
- Nom sonnerie iphone - Forum iPhone
2 réponses
FUNCTION url_exists($strURL) {
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $strURL);
curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
curl_exec ($resURL);
$intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
curl_close ($resURL);
IF ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) {
RETURN FALSE;
} ELSE {
RETURN TRUE;
}
}
----------
http://www.avantina.fr
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $strURL);
curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
curl_exec ($resURL);
$intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
curl_close ($resURL);
IF ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) {
RETURN FALSE;
} ELSE {
RETURN TRUE;
}
}
----------
http://www.avantina.fr
1) tu récupère le nom de domaine
2) tu le ping (avec ça par exempel : http://pear.php.net/manual/fr/package.networking.net-ping.ping.php )
a) pas de réponde : dispo
b) réponse : indispo
2) tu le ping (avec ça par exempel : http://pear.php.net/manual/fr/package.networking.net-ping.ping.php )
a) pas de réponde : dispo
b) réponse : indispo
Merci pour cette idée , durant ma recherche j ai trouvé un code sympa
le voila :
<?php
$result = '';
$theNdd = trim($_POST['theNdd']);
$theExt = $_POST['theExt'];
if (!empty($theNdd) AND !empty($theExt)) {
$theNdd = preg_replace(array( '/http:\/\/www\./',
'/http:\/\//',
'/www\./' ),
array( '', '', '') ,$theNdd);
$theNdd = preg_replace(array( '/\.eu/',
'/\.fr/',
'/\.com/',
'/\.net/',
'/\.org/',
'/\.info/',
'/\.biz/',
'/\.de/',
'/\.me.uk/',
'/\.co.uk/',
'/\.org.uk/',
'/\.ca/' ),
array( '', '', '', '', '', '', '', '', '', '', '', '') ,$theNdd);
$theNdd = escapeshellcmd($theNdd);
//on definit les case du tableau à vérifier
$caseForVerif['.net']=7;
$caseForVerif['.com']=7;
$caseForVerif['.org']=0;
$caseForVerif['.fr']=13;
$caseForVerif['.ca']=5;
$caseForVerif['.info']=0;
$caseForVerif['.biz']=1;
$caseForVerif['.de']=35;
$caseForVerif['.eu']=50;
$caseForVerif['.me.uk']=30;
$caseForVerif['.co.uk']=30;
$caseForVerif['.org.uk']=40;
//on definit les phrase à vérifier dans ces cases
$strForVerif['.com']='No match for "'.$theNdd.'.COM".';
$strForVerif['.fr']='%% No entries found in the AFNIC Database.';
$strForVerif['.net']='No match for "'.$theNdd.'.NET".';
$strForVerif['.org']='NOT FOUND';
$strForVerif['.ca']='';
$strForVerif['.info']='NOT FOUND';
$strForVerif['.biz']='';
$strForVerif['.de']='';
$strForVerif['.eu']='';
$strForVerif['.me.uk']='';
$strForVerif['.co.uk']='';
$strForVerif['.org.uk']='';
foreach($theExt as $anExt) {
$myArray="";
$anExt=escapeshellcmd($anExt);
exec('whois '.$theNdd.$anExt,$myArray,$retval);
$result.=(strtolower($myArray[$caseForVerif[$anExt]])==strtolower($strForVerif[$anExt]))?"->> ".$theNdd.$anExt." est libre<br/>":"->> ".$theNdd.$anExt." est déjà réservé<br />";
}
}
?>
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" name="formVeirfNdd" enctype="multipart/form-data" method="post">
www.<input type="text" name="theNdd" value="<?php echo $theNdd; ?>" />
<input name="theExt[]" type="checkbox" value=".com" id="com" checked><label for="com">.com</label>
<input name="theExt[]" type="checkbox" value=".eu" id="eu"><label for="eu">.eu</label>
<input name="theExt[]" type="checkbox" value=".fr" id="fr"><label for="fr">.fr</label>
<input name="theExt[]" type="checkbox" value=".net" id="net"><label for="net">.net</label>
<input name="theExt[]" type="checkbox" value=".org" id="org"><label for="org">.org</label>
<input name="theExt[]" type="checkbox" value=".info" id="info"><label for="info">.info</label>
<input name="theExt[]" type="checkbox" value=".ca" id="ca"><label for="ca">.ca</label>
<input name="theExt[]" type="checkbox" value=".biz" id="biz"><label for="biz">.biz</label>
<input name="theExt[]" type="checkbox" value=".de" id="de"><label for="de">.de</label>
<input name="theExt[]" type="checkbox" value=".me.uk" id="me.uk"><label for="me.uk">me.uk</label>
<input name="theExt[]" type="checkbox" value=".co.uk" id="co.uk"><label for="co.uk">co.uk</label>
<input name="theExt[]" type="checkbox" value=".org.uk" id="org.uk"><label for="org.uk">org.uk</label>
<input type="submit" value="Vérifier">
</form>
<?php echo '<h3>'.$result.'</h3>'; ?>
===========================================
Encore sous teste .. car il beugue Tjs
le voila :
<?php
$result = '';
$theNdd = trim($_POST['theNdd']);
$theExt = $_POST['theExt'];
if (!empty($theNdd) AND !empty($theExt)) {
$theNdd = preg_replace(array( '/http:\/\/www\./',
'/http:\/\//',
'/www\./' ),
array( '', '', '') ,$theNdd);
$theNdd = preg_replace(array( '/\.eu/',
'/\.fr/',
'/\.com/',
'/\.net/',
'/\.org/',
'/\.info/',
'/\.biz/',
'/\.de/',
'/\.me.uk/',
'/\.co.uk/',
'/\.org.uk/',
'/\.ca/' ),
array( '', '', '', '', '', '', '', '', '', '', '', '') ,$theNdd);
$theNdd = escapeshellcmd($theNdd);
//on definit les case du tableau à vérifier
$caseForVerif['.net']=7;
$caseForVerif['.com']=7;
$caseForVerif['.org']=0;
$caseForVerif['.fr']=13;
$caseForVerif['.ca']=5;
$caseForVerif['.info']=0;
$caseForVerif['.biz']=1;
$caseForVerif['.de']=35;
$caseForVerif['.eu']=50;
$caseForVerif['.me.uk']=30;
$caseForVerif['.co.uk']=30;
$caseForVerif['.org.uk']=40;
//on definit les phrase à vérifier dans ces cases
$strForVerif['.com']='No match for "'.$theNdd.'.COM".';
$strForVerif['.fr']='%% No entries found in the AFNIC Database.';
$strForVerif['.net']='No match for "'.$theNdd.'.NET".';
$strForVerif['.org']='NOT FOUND';
$strForVerif['.ca']='';
$strForVerif['.info']='NOT FOUND';
$strForVerif['.biz']='';
$strForVerif['.de']='';
$strForVerif['.eu']='';
$strForVerif['.me.uk']='';
$strForVerif['.co.uk']='';
$strForVerif['.org.uk']='';
foreach($theExt as $anExt) {
$myArray="";
$anExt=escapeshellcmd($anExt);
exec('whois '.$theNdd.$anExt,$myArray,$retval);
$result.=(strtolower($myArray[$caseForVerif[$anExt]])==strtolower($strForVerif[$anExt]))?"->> ".$theNdd.$anExt." est libre<br/>":"->> ".$theNdd.$anExt." est déjà réservé<br />";
}
}
?>
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" name="formVeirfNdd" enctype="multipart/form-data" method="post">
www.<input type="text" name="theNdd" value="<?php echo $theNdd; ?>" />
<input name="theExt[]" type="checkbox" value=".com" id="com" checked><label for="com">.com</label>
<input name="theExt[]" type="checkbox" value=".eu" id="eu"><label for="eu">.eu</label>
<input name="theExt[]" type="checkbox" value=".fr" id="fr"><label for="fr">.fr</label>
<input name="theExt[]" type="checkbox" value=".net" id="net"><label for="net">.net</label>
<input name="theExt[]" type="checkbox" value=".org" id="org"><label for="org">.org</label>
<input name="theExt[]" type="checkbox" value=".info" id="info"><label for="info">.info</label>
<input name="theExt[]" type="checkbox" value=".ca" id="ca"><label for="ca">.ca</label>
<input name="theExt[]" type="checkbox" value=".biz" id="biz"><label for="biz">.biz</label>
<input name="theExt[]" type="checkbox" value=".de" id="de"><label for="de">.de</label>
<input name="theExt[]" type="checkbox" value=".me.uk" id="me.uk"><label for="me.uk">me.uk</label>
<input name="theExt[]" type="checkbox" value=".co.uk" id="co.uk"><label for="co.uk">co.uk</label>
<input name="theExt[]" type="checkbox" value=".org.uk" id="org.uk"><label for="org.uk">org.uk</label>
<input type="submit" value="Vérifier">
</form>
<?php echo '<h3>'.$result.'</h3>'; ?>
===========================================
Encore sous teste .. car il beugue Tjs
1- Est ce que je peux afficher les code d erreur au lieu d afficher les nombre 200 , 302 et 304.
2- Return False ==> Le nom domaine est trouvé ou pas .?
curl_init();
n est pas reconnu dans mon easyphp
Je n'utilise plus easyphp mais quelques part dans l'interface tu peux peut être le sélectionner ou alors tu décommante la ligne dans le php.ini extension=php_curl.dll
FUNCTION url_exists($strURL) {
$resURL = curl_init();
curl_setopt($resURL, CURLOPT_URL, $strURL);
curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback');
curl_setopt($resURL, CURLOPT_FAILONERROR, 1);
curl_exec ($resURL);
$intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE);
curl_close ($resURL);
IF ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) {
echo "ok!";
RETURN FALSE;
} ELSE {
echo "Not ok!";
RETURN TRUE;
}
}
Dans le body j ai ecris :
<?php
url_exists('www.google.com');
?>
Et mnt j ai l erreur :
Warning: curl_exec() [function.curl-exec]: Could not call the CURLOPT_HEADERFUNCTION in C:\Program Files\EasyPHP-5.3.8.1\www\Domaine\index_Test.php on line 9
Not ok!