Code :
- function getProvider($ip)
- {
- $Provider = "?";
- $command = "/perl/whois?searchtext=" . $ip . "&do_search=Do+Search";
- $fp = fsockopen( "www.ripe.net", 80, &$errno, &$errstr, 30);
- if($fp)
- {
- // Recherche du Provider
- fputs($fp,"GET $command HTTP/1.0\n\n" );
- $buff = "";
- while(!feof($fp))
- {
- $buff .= fgets($fp,128);
- }
- fclose($fp);
- $p1 = strpos( $buff, "descr:" );
- $p2 = strpos( $buff, "country:" );
- $Descr = substr( $buff, $p1 + 14, $p2 - $p1 - 15 );
- $Descr = str_replace( "\ndescr: ", ", ", $Descr );
- $buff = substr( $buff, $p2 + 14 );
- $p2 = strpos( $buff, "\n" );
- $Country = substr( $buff, 0, $p2 );
- $Provider = $Descr . "\nCountry : " . $Country;
- }
- return( $Provider );
- }
|