http://www.creatsiteweb.com
Actualités et sujets informatiques
 
AccueilPortailRechercherS’enregistrerConnexion
Derniers sujets
» Verrouiller un dossier ou un fichier
Lun 7 Juil - 18:36 par rene

» Choisir un référenceur ?
Mer 2 Juil - 14:43 par jos

» Télétravail de webmaster sur Recruteo
Dim 29 Juin - 19:04 par doris

» Cherche un referenceur
Sam 28 Juin - 20:47 par omar

» Recherche commercial(e) vente par téléphone
Jeu 26 Juin - 15:11 par durand

» Devis pour référencer mon site
Dim 22 Juin - 10:36 par roger2

» Travail à domicile
Sam 14 Juin - 10:14 par yves

» Promotions et logiciels gratuits
Jeu 12 Juin - 15:27 par gustin

» Nouvelle version d'Open Office
Dim 1 Juin - 22:31 par felix

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Partenaires
Rechercher
 


 Résultats par :
 
Rechercher Recherche avancée
Aspiration des infos sur une ip en php
Dim 23 Mar - 17:35 par Admin
<?
// --- Récupération des infos pour une IP

class ip_infos
{
// --- variables
var $msg_erreur
;
var
$erreur = 0
;
var
$serveur_whois = 'whois.arin.net'
;
var
$serveur_whois2 = ''
;
var
$whois_texte = ''
;

function
ip_infos($ip
) {
// --- IP valide ?
$host = gethostbyaddr($ip
);
if (!
$ip == gethostbyname($host
)) {
$this->msg_erreur .= "$ip: adresse IP invalide<br>\n"
;
$this->erreur = 1
;
}
// --- connexion au serveur whois
if (!$this->erreur
) {
if (!
$sock = fsockopen($this->serveur_whois, 43, $num, $error, 20
)) {
unset(
$sock
);
$this->msg_erreur .=
"Connexion impossible au serveur "
. $this->serveur_whois." (port 43)"
;
$this->erreur = 2
;
}
}
// --- lecture des infos
if (!$this->erreur
) {
$this->whois_texte = ''
;
fputs($sock, $ip."\n"
);
while (!
feof($sock
)) {
$this->whois_texte .= fgets($sock, 10240
);
}
fclose($sock
);
// --- serveur whois complémentaire ?
if (eregi("RIPE.NET", $this->whois_texte
)) {
$this->serveur_whois2 = "whois.ripe.net"
;
}
elseif (
eregi("whois.apnic.net", $this->whois_texte
)) {
$this->serveur_whois2 = "whois.apnic.net"
;
}
elseif (
eregi("nic.ad.jp", $this->whois_texte
)) {
$this->serveur_whois2 = "whois.nic.ad.jp"
;
// --- suppression des caractères japonais sur JPNIC
$flag = "/e"
;
}
elseif (
eregi("whois.registro.br", $this->whois_texte
)) {
$this->serveur_whois2 = "whois.registro.br"
;
}
}
// --- interrogation du second serveur whois
if($this->serveur_whois2 && !$this->erreur
) {
$this->whois_texte = ""
;
if(!
$sock = fsockopen($this->serveur_whois2, 43, $num, $error, 10
)) {
unset(
$sock
);
$this->msg_erreur .=
"Connexion impossible au serveur "
. $this->serveur_whois2 ." (port 43)"
;
}
else {
fputs($sock, $ip.$flag."\n"
);
while (!
feof($sock
)) {
$this->whois_texte .= fgets($sock, 10240
);
}
fclose($sock
);
}
}
if(!
$this->erreur
) {
$tb_lignes = explode(chr(10), $this->whois_texte
);
$this->infos
= array();
for (
$i=0; $i<count($tb_lignes); $i
++) {
$tmptb = explode(":", $tb_lignes[$i
]);
if (
count($tmptb) > 1 && substr($tmptb[0], 0, 1)!='%'
) {
$key = trim($tmptb[0
]);
$val = trim($tmptb[1
]);
if(
strlen($this->infos["$key"]) > 0
) {
$this->infos["$key"] .= ', ' . $val
;
}
elseif (
$key) $this->infos["$key"] = $val
;
}
}
}
}

}
?>


Commentaires: 1
Sondage
Forum
Qui est en ligne ?
Il y a en tout 1 utilisateur en ligne :: 0 Enregistré, 0 Invisible et 1 Invité

Utilisateurs enregistrés : Aucun


[ Voir toute la liste ]

Le record du nombre d’utilisateurs en ligne est de 3 le Sam 7 Juin - 21:57
Statistiques
Nous avons 63 membres enregistrés
L’utilisateur enregistré le plus récent est rene

Nos membres ont posté un total de 87 messages dans 52 sujets