简体   繁体   中英

check a mail ip adress in mail blacklist using php

how can i query a mail ip address in mail black list.i have try some think like that:

    if ( $ip ) {
       $quads = explode( ".", $ip ); 
        $rip = $quads[ 3 ].".".$quads[ 2 ].".".$quads[ 1 ].".".$quads[ 0 ];
        if( function_exists( 'checkdnsrr' ) ) {
            for ($i = 0; $i < count( $dnsbl_check ); $i++ ) {
                if ( checkdnsrr( $rip.".".trim( $dnsbl_check[ $i ] ),"A" ) ) {
                    echo '<font color = "red">'.$dnsbl_check[ $i ].'<br>';
                } else {
                    echo '<font color = "green">'.$dnsbl_check[ $i ].'<br>';
                }
            }
        }
    } 
} 

but i'm not sure about this method. is it true way ? or anybody has different idea ?

If you are using linux, this can be done using the host command:

exec('host 64.34.119.12', $response);

or

exec('host stackoverflow.com', $response);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM