Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once( dirname(__FILE__).'/includes/load-yourls.php' );
- // Let's test a legit URL
- $url = 'https://www.google.com/';
- // Below is code from the plugin, modified to var_dump() instead of return a result
- $parsed = parse_url( $url );
- if( !isset( $parsed['host'] ) )
- return yourls_apply_filter( 'ozh_yourls_antispam_malformed', 'malformed' );
- // Remove www. from domain (but not from www.com)
- $parsed['host'] = preg_replace( '/^www\.(.+\.)/i', '$1', $parsed['host'] );
- // Major blacklists. There's a filter if you want to manipulate this.
- $blacklists = yourls_apply_filter( 'ozh_yourls_antispam_list',
- array(
- 'zen.spamhaus.org',
- 'multi.surbl.org',
- 'black.uribl.com',
- 'nope.niet.nein',
- )
- );
- // Check against each blacklist, exit if blacklisted
- foreach( $blacklists as $blacklist ) {
- $domain = $parsed['host'] . '.' . $blacklist . '.';
- $record = @dns_get_record( $domain );
- var_dump( $blacklist, $record );
- }
- /* RESULT :
- **********
- string 'zen.spamhaus.org' (length=16)
- array (size=0)
- empty
- string 'multi.surbl.org' (length=15)
- array (size=0)
- empty
- string 'black.uribl.com' (length=15)
- array (size=0)
- empty
- string 'nope.niet.nein' (length=14)
- array (size=0)
- empty
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement