package.xml100644 1750 1750 5554 11217407206 6426 Net_DNSBL pear.php.net Checks if a given Host or URL is listed on an DNS-based Blackhole List (DNSBL, Real-time Blackhole List or RBL) or Spam URI Realtime Blocklist (SURBL) Checks if a given Host or URL is listed on an DNS-based Blackhole List (DNSBL, Real-time Blackhole List or RBL) or Spam URI Realtime Blocklist (SURBL) Sebastian Nohn nohn sebastian@nohn.net yes Ammar Ibrahim ammarmi ammar@gnuix.com no 2009-06-21 1.3.3 1.3.0 stable stable PHP License * Fix #16353 4.3.11 1.4.0b1 Cache_Lite pear.php.net 1.4.1 Net_DNS pear.php.net 1.0.0 Net_CheckIP pear.php.net 1.1 HTTP_Request pear.php.net 1.2.3 Net_DNSBL-1.3.3/Net/DNSBL/SURBL.php100644 1750 1750 13200 11217407206 11414 * @author Ammar Ibrahim * @copyright 2004-2009 Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: SURBL.php,v 1.11 2009/05/08 07:10:42 nohn Exp $ * @link http://pear.php.net/package/Net_DNSBL * @see Net_DNS * @since File available since Release 1.0.0 */ require_once 'Cache/Lite.php'; require_once 'HTTP/Request.php'; require_once 'Net/CheckIP.php'; require_once 'Net/DNSBL.php'; /** * PEAR::Net_DNSBL_SURBL * * This class acts as interface to the SURBL - Spam URI Realtime Blocklists. * * Services_SURBL looks up an supplied URI if it's listed in a * Spam URI Realtime Blocklists. * * @category Net * @package Net_DNSBL * @author Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version Release: 1.3.3 * @link http://pear.php.net/package/net_dnsbl Package Home */ class Net_DNSBL_SURBL extends Net_DNSBL { /** * Array of blacklists. * * Must have one or more elements. * * @var string[] * @access protected */ var $blacklists = array('multi.surbl.org'); /** * File containing whitelisted hosts. * * There are some whitelisted hosts (co.uk for example). This * requires the package to not ask the domain name but the host * name (spammer.co.uk instead of co.uk). * * @var string * @see $twoLevelCcTld * @access protected */ var $doubleCcTldFile = 'http://spamcheck.freeapp.net/two-level-tlds'; /** * Array of whitelisted hosts. * * @var array * @see $twoLevelCcTldFile * @access private */ var $twoLevelCcTld = array(); /** * Check if the last two parts of the FQDN are whitelisted. * * @param string $fqdn Host to check if it is whitelisted. * * @access protected * @return boolean True if the host is whitelisted */ function isDoubleCcTld($fqdn) { // 30 Days should be way enough $options = array( 'lifeTime' => '2592000', 'automaticSerialization' => true ); $id = md5($this->doubleCcTldFile); $cache = new Cache_Lite($options); if ($data = $cache->get($id)) { // Cache hit } else { // Cache miss $http = &new HTTP_Request($this->doubleCcTldFile); if (!PEAR::isError($http->sendRequest())) { $data = $http->getResponseBody(); } $data = explode("\n", $data); $data = array_flip($data); $cache->save($data, $id); } // if if (array_key_exists($fqdn, $data)) { return true; } else { return false; } // if } // function /** * Get Hostname to ask for. * * Performs the following steps: * * (1) Extract the hostname from the given URI * (2) Check if the "hostname" is an ip * (3a) IS_IP Reverse the IP (1.2.3.4 -> 4.3.2.1) * (3b) IS_FQDN Check if is in "CC-2-level-TLD" * (3b1) IS_IN_2LEVEL: we want the last three names * (3b2) IS_NOT_2LEVEL: we want the last two names * (4) return the FQDN to query. * * @param string $uri URL to check. * @param string $blacklist Blacklist to check against. * * @access protected * @return string Host to lookup */ function getHostForLookup($uri, $blacklist) { // (1) Extract the hostname from the given URI $host = ''; $parsed_uri = parse_url($uri); $host = urldecode($parsed_uri['host']); // (2) Check if the "hostname" is an ip if (Net_CheckIP::check_ip($host)) { // (3a) IS_IP Reverse the IP (1.2.3.4 -> 4.3.2.1) $host = $this->reverseIp($host); } else { $host_elements = explode('.', $host); while (count($host_elements) > 3) { array_shift($host_elements); } // while $host_3_elements = implode('.', $host_elements); $host_elements = explode('.', $host); while (count($host_elements) > 2) { array_shift($host_elements); } // while $host_2_elements = implode('.', $host_elements); // (3b) IS_FQDN Check if is in "CC-2-level-TLD" if ($this->isDoubleCcTld($host_2_elements)) { // (3b1) IS_IN_2LEVEL: we want the last three names $host = $host_3_elements; } else { // (3b2) IS_NOT_2LEVEL: we want the last two names $host = $host_2_elements; } // if } // if // (4) return the FQDN to query $host .= '.'.$blacklist; return $host; } // function } // class ?>Net_DNSBL-1.3.3/Net/DNSBL.php100644 1750 1750 22262 11217407206 10535 * @author Ammar Ibrahim * @copyright 2004-2009 Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: DNSBL.php,v 1.14 2009/06/21 10:32:21 nohn Exp $ * @link http://pear.php.net/package/Net_DNSBL * @see Net_DNS * @since File available since Release 1.0.0 */ require_once 'Net/CheckIP.php'; require_once 'Net/DNS.php'; /** * PEAR::Net_DNSBL * * This class acts as interface to DNSBLs * * Net_DNSBL looks up an supplied IP if it's listed in a * DNS Blacklist. * * @category Net * @package Net_DNSBL * @author Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version Release: 1.3.3 * @link http://pear.php.net/package/net_dnsbl Package Home */ class Net_DNSBL { /** * Array of blacklists. * * Must have one or more elements. * * @var array * @access protected */ var $blacklists = array('sbl-xbl.spamhaus.org', 'bl.spamcop.net'); /** * Array of Results * * @var array * @access protected */ var $results = array(); /** * Set the blacklist to a desired blacklist. * * @param array $blacklists Array of blacklists to use. * * @access public * @return bool true if the operation was successful */ function setBlacklists($blacklists) { if (is_array($blacklists)) { $this->blacklists = $blacklists; return true; } else { return false; } // if } // function /** * Get the blacklists. * * @access public * @return array Currently set blacklists. */ function getBlacklists() { return $this->blacklists; } /** * Returns Blacklist and Reply from the Blacklist, a host is listed in. * * @param string $host Host to check * * @access public * @return array result. $result['dnsbl'] contains DNSBL, * $result['record'] contains returned DNS record. */ function getDetails($host) { if (isset($this->results[$host])) { if (count($this->results[$host])>1) { return $this->results[$host]; } else { return $this->results[$host][0]; } } else { return false; } } // function /** * Returns Blacklist, host is listed in. * * @param string $host Host to check * * @access public * @return bl, a host is listed in or false */ function getListingBl($host) { if (isset($this->results[$host]['dnsbl'])) { return $this->results[$host]['dnsbl']; } else { return false; } } // function /** * Returns Blacklists, host is listed in. isListed() must have * been called with checkall = true * * @param string $host Host to check * * @access public * @return array blacklists, a host is listed in or false */ function getListingBls($host) { if (is_array($this->results[$host])) { $result = array_keys($this->results[$host]); if ($result == null) { return false; } else { return $result; } } else { return false; } } // function /** * Returns result, when a host is listed. * * @param string $host Host to check * * @access public * @return bl, a host is listed in or false */ function getListingRecord($host) { if (isset($this->results[$host]['record'])) { return $this->results[$host]['record']; } else { return false; } } // function /** * Returns TXT-Records, when a host is listed. * * @param string $host Host to check * * @access public * @return array TXT-Records for this host */ function getTxt($host) { if (isset($this->results[$host]['txt'])) { return $this->results[$host]['txt']; } else { return false; } } // function /** * Checks if the supplied Host is listed in one or more of the * RBLs. * * @param string $host Host to check for being listed. * @param boolean $checkall Iterate through all blacklists and * return all A records or stop after * the first hit? * * @access public * @return boolean true if the checked host is listed in a blacklist. */ function isListed($host, $checkall = false) { $isListed = false; $resolver = new Net_DNS_Resolver; if (!is_string($host)) { return false; } foreach ($this->blacklists as $blacklist) { $response = $resolver->query($this->getHostForLookup($host, $blacklist)); if ($response) { $isListed = true; if ($checkall) { $this->results[$host][$blacklist] = array(); foreach ($response->answer as $answer) { $this->results[$host][$blacklist]['record'][] = $answer->address; } $response_txt = $resolver->query( $this->getHostForLookup( $host, $blacklist ), 'TXT' ); if (isset($response_txt->answer)) { foreach ($response_txt->answer as $txt) { $this->results[$host][$blacklist]['txt'][] = $txt->text[0]; } } } else { $this->results[$host]['dnsbl'] = $blacklist; $this->results[$host]['record'] = $response->answer[0]->address; $response_txt = $resolver->query( $this->getHostForLookup( $host, $blacklist ), 'TXT' ); if ((isset($response_txt)) && ($response_txt != false)) { foreach ($response_txt->answer as $txt) { $this->results[$host]['txt'][] = $txt->text[0]; } } // if the Host was listed we don't need to check other RBLs, break; } } // if } // foreach return $isListed; } // function /** * Get host to lookup. Lookup a host if neccessary and get the * complete FQDN to lookup. * * @param string $host Host OR IP to use for building the lookup. * @param string $blacklist Blacklist to use for building the lookup. * * @access protected * @return string Ready to use host to lookup */ function getHostForLookup($host, $blacklist) { // Currently only works for v4 addresses. if (!Net_CheckIP::check_ip($host)) { $resolver = new Net_DNS_Resolver; $response = $resolver->query($host); $ip = $response->answer[0]->address; } else { $ip = $host; } return $this->buildLookUpHost($ip, $blacklist); } // function /** * Build the host to lookup from an IP. * * @param string $ip IP to use for building the lookup. * @param string $blacklist Blacklist to use for building the lookup. * * @access protected * @return string Ready to use host to lookup */ function buildLookUpHost($ip, $blacklist) { return $this->reverseIp($ip).'.'.$blacklist; } // function /** * Reverse the order of an IP. 127.0.0.1 -> 1.0.0.127. Currently * only works for v4-adresses * * @param string $ip IP address to reverse. * * @access protected * @return string Reversed IP */ function reverseIp($ip) { return implode('.', array_reverse(explode('.', $ip))); } // function } // class ?>Net_DNSBL-1.3.3/tests/AllTests.php100644 1750 1750 4261 11217407206 12021 * @copyright 2004-2009 Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: AllTests.php,v 1.8 2009/04/04 14:29:56 nohn Exp $ * @link http://pear.php.net/package/Net_DNSBL Package Home * @see Net_DNS * @since File available since Release 1.0.0 */ ini_set('display_errors', 'On'); require_once 'PHPUnit/Framework/TestSuite.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; require_once 'testNetDNSBL.php'; require_once 'testNetDNSBLSURBL.php'; /** * AllTests * * This class integrates all unit tests. * * @category Net * @package Net_DNSBL * @author Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version Release: 1.3.3 * @link http://pear.php.net/package/net_dnsbl Package Home */ class AllTests { /** * Execute tests * * @access public * @return boolean true on success, false on failure */ public static function main() { PHPUnit_TextUI_TestRunner::run(self::suite()); } /** * Set up testsuite * * @access public * @return boolean true on success, false on failure */ public static function suite() { $suite = new PHPUnit_Framework_TestSuite('Net_DNSBL TestSuite'); $suite->addTestSuite('TestNetDNSBL'); $suite->addTestSuite('TestNetDNSBLSURBL'); return $suite; } } ?> Net_DNSBL-1.3.3/tests/testNetDNSBL.php100644 1750 1750 24702 11217407206 12521 * @copyright 2004-2009 Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: testNetDNSBL.php,v 1.24 2009/06/21 10:32:21 nohn Exp $ * @link http://pear.php.net/package/Net_DNSBL Package Home * @see Net_DNS * @since File available since Release 1.0.0 */ require_once "Net/DNSBL.php"; require_once "PHPUnit/Framework/TestCase.php"; /** * TestNetDNSBL * * This class tests all public Net_DNSBL methods * * @category Net * @package Net_DNSBL * @author Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version Release: 1.3.3 * @link http://pear.php.net/package/net_dnsbl Package Home */ class TestNetDNSBL extends PHPUnit_Framework_TestCase { private $_rbl; /** * Set up Testcase for Net_DNSBL * * @return boolean true on success, false on failure */ protected function setUp() { $this->_rbl = new Net_DNSBL; } /** * Test if known spam hosts are always identified correctly as such. * * @return boolean true on success, false on failure */ public function testHostsAlwaysAreListed() { $this->assertTrue($this->_rbl->isListed("127.0.0.2")); $this->assertContains( "http://www.spamhaus.org/query/bl?ip=127.0.0.2", $this->_rbl->getTxt('127.0.0.2') ); $this->assertContains( "http://www.spamhaus.org/SBL/sbl.lasso?query=SBL233", $this->_rbl->getTxt('127.0.0.2') ); } /** * Test if hosts that should not be know as spam hostsare always * identified correctly as such. * * @return boolean true on success, false on failure */ public function testTrustworthyHostsArentListed() { $this->_rbl->setBlacklists(array('dun.dnsrbl.net')); $this->assertFalse($this->_rbl->isListed("mail.nohn.net")); $this->assertFalse($this->_rbl->isListed("212.112.226.205")); $this->assertFalse($this->_rbl->isListed("smtp1.google.com")); } /** * Test public setters * * @return boolean true on success, false on failure */ public function testSetters() { $this->assertTrue($this->_rbl->setBlacklists(array('dun.dnsrbl.net'))); $this->assertEquals(array('dun.dnsrbl.net'), $this->_rbl->getBlacklists()); $this->assertFalse($this->_rbl->setBlacklists('dnsbl.sorbs.net')); } /** * Test public setters and include some lookups. * * @return boolean true on success, false on failure */ public function testSettersAndLookups() { $this->_rbl->setBlacklists(array('dnsbl.sorbs.net')); $this->assertEquals(array('dnsbl.sorbs.net'), $this->_rbl->getBlacklists()); $this->assertFalse($this->_rbl->isListed("mail.nohn.net")); $this->assertTrue($this->_rbl->isListed("p50927464.dip.t-dialin.net")); } /** * Test getDetails() * * @return boolean true on success, false on failure */ public function testGetDetails() { $this->_rbl->setBlacklists(array('dnsbl.sorbs.net')); $this->assertTrue($this->_rbl->isListed("p50927464.dip.t-dialin.net")); $this->assertEquals( array( "dnsbl" => "dnsbl.sorbs.net", "record" => "127.0.0.10", "txt" => array( 0 => "Dynamic IP Addresses See: ". "http://www.sorbs.net/lookup.shtml?80.146.116.100" ) ), $this->_rbl->getDetails("p50927464.dip.t-dialin.net") ); $this->assertFalse($this->_rbl->getDetails("mail.nohn.net")); $this->assertFalse($this->_rbl->getDetails("somehost.we.never.queried")); } /** * Test getListingBl() * * @return boolean true on success, false on failure */ public function testGetListingBl() { $this->_rbl->setBlacklists(array('dnsbl.sorbs.net')); $this->assertTrue($this->_rbl->isListed("p50927464.dip.t-dialin.net")); $this->assertEquals( "dnsbl.sorbs.net", $this->_rbl->getListingBl("p50927464.dip.t-dialin.net") ); $this->assertFalse($this->_rbl->getListingBl("www.google.de")); } /** * Test getListingRecord() * * @return boolean true on success, false on failure */ public function testGetListingRecord() { $this->_rbl->setBlacklists(array('dnsbl.sorbs.net')); $this->assertTrue($this->_rbl->isListed("p50927464.dip.t-dialin.net")); $this->assertEquals( "127.0.0.10", $this->_rbl->getListingRecord("p50927464.dip.t-dialin.net") ); $this->assertFalse($this->_rbl->getListingRecord("www.google.de")); } /** * Test getTxt() * * @return boolean true on success, false on failure */ public function testGetTxt() { $this->_rbl->setBlacklists(array('dnsbl.sorbs.net')); $this->assertTrue($this->_rbl->isListed("p50927464.dip.t-dialin.net")); $this->assertEquals( "127.0.0.10", $this->_rbl->getListingRecord("p50927464.dip.t-dialin.net") ); $this->assertEquals( array(0 => "Dynamic IP Addresses See: ". "http://www.sorbs.net/lookup.shtml?80.146.116.100"), $this->_rbl->getTxt("p50927464.dip.t-dialin.net") ); $this->assertFalse($this->_rbl->getTxt("www.google.de")); } /** * Test results with multiple blacklists (host not listed) * * @return boolean true on success, false on failure */ public function testMultipleBlacklists() { $this->_rbl->setBlackLists( array('sbl-xbl.spamhaus.org', 'bl.spamcop.net' ) ); $this->assertFalse($this->_rbl->isListed('212.112.226.205')); $this->assertFalse($this->_rbl->getListingBl('212.112.226.205')); } /** * Test results with multiple blacklists (listed test host) * * @return boolean true on success, false on failure */ public function testIsListedMulti() { $this->_rbl->setBlackLists( array( 'sbl-xbl.spamhaus.org', 'bl.spamcop.net' ) ); $this->assertTrue($this->_rbl->isListed('127.0.0.2', true)); } /** * Test getBlacklists() with multiple blacklists (listed test host) * * @return boolean true on success, false on failure */ public function testGetListingBls() { $this->_rbl->setBlackLists( array('sbl-xbl.spamhaus.org', 'bl.spamcop.net' ) ); $this->assertTrue($this->_rbl->isListed('127.0.0.2', true)); $this->assertEquals( array( 'sbl-xbl.spamhaus.org', 'bl.spamcop.net' ), $this->_rbl->getListingBls('127.0.0.2') ); $this->assertFalse($this->_rbl->isListed('smtp1.google.com', true)); $this->assertEquals(false, $this->_rbl->getListingBls('smtp1.google.com')); $result = $this->_rbl->getDetails('127.0.0.2'); $this->assertContains( '127.0.0.2', $result['sbl-xbl.spamhaus.org']['record'] ); $this->assertContains( 'http://www.spamhaus.org/SBL/sbl.lasso?query=SBL233', $result['sbl-xbl.spamhaus.org']['txt'] ); $this->assertContains( 'http://www.spamhaus.org/query/bl?ip=127.0.0.2', $result['sbl-xbl.spamhaus.org']['txt'] ); $this->assertContains('127.0.0.2', $result['bl.spamcop.net']['record']); $this->assertContains( 'Blocked - see http://www.spamcop.net/bl.shtml?127.0.0.2', $result['bl.spamcop.net']['txt'] ); $this->assertFalse($this->_rbl->getDetails('smtp1.google.com')); } /** * Test without caching. * * @return boolean true on success, false on failure */ public function testCacheNoCache() { for ($i=1; $i<=10; $i++) { $this->assertFalse($this->_rbl->isListed($i.'.nohn.net')); $this->assertFalse($this->_rbl->isListed(md5(rand()).'.nohn.net')); } } /** * Test Bokus * * @return boolean true on success, false on failure */ public function testBogusInput() { $this->_rbl->setBlacklists(array('rbl.efnet.org')); $this->assertFalse($this->_rbl->isListed(null)); $this->assertFalse($this->_rbl->getTxt(null)); $this->assertFalse($this->_rbl->isListed(false)); $this->assertFalse($this->_rbl->getTxt(false)); $this->assertFalse($this->_rbl->isListed(true)); $this->assertFalse($this->_rbl->getTxt(true)); } /** * Test different behaviour on TXT-Records with multiple * RBLs * * @see http://pear.php.net/bugs/bug.php?id=16353 * * @return boolean true on success, false on failure */ public function testDifferentBehaviourOnTxtRecordsWithMultipleRbls() { $this->_rbl->setBlacklists( array( 'dnsbl.sorbs.net', 'rbl.efnetrbl.org', 'dnsbl.dronebl.org', 'xbl.spamhaus.org', 'tor.dnsbl.sectoor.de', 'cbl.abuseat.org', 'dnsbl.njabl.org' ) ); if ($this->_rbl->isListed('127.0.0.2', true)) { $this->assertTrue(is_array($this->_rbl->getDetails('127.0.0.2'))); } if ($this->_rbl->isListed('79.141.17.68', true)) { $this->assertTrue(is_array($this->_rbl->getDetails('127.0.0.2'))); } } } ?>Net_DNSBL-1.3.3/tests/testNetDNSBLSURBL.php100644 1750 1750 13144 11217407206 13327 * @copyright 2004-2009 Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: testNetDNSBLSURBL.php,v 1.19 2009/05/08 07:10:42 nohn Exp $ * @link http://pear.php.net/package/Net_DNSBL Package Home * @see Net_DNS * @since File available since Release 1.0.0 */ require_once 'Net/DNSBL/SURBL.php'; require_once 'PHPUnit/Framework/TestCase.php'; /** * TestNetDNSBLSURBL * * This class tests all public Net_DNSBL_SURBL methods * * @category Net * @package Net_DNSBL * @author Sebastian Nohn * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version Release: 1.3.3 * @link http://pear.php.net/package/net_dnsbl Package Home */ class TestNetDNSBLSURBL extends PHPUnit_Framework_TestCase { private $_surbl; /** * Set up Testcase for Net_DNSBL_SURBL * * @return boolean true on success, false on failure */ protected function setUp() { $this->_surbl = new Net_DNSBL_SURBL; } /** * Tests if a test spam URL is always correctly identified as such. * * @return boolean true on success, false on failure */ public function testSpamUrlsAlwaysGetReportedAsSpam() { $this->assertTrue( $this->_surbl->isListed( 'http://surbl-org-permanent'. '-test-point.com/justatest' ) ); $this->assertEquals( array(0 => 'multi.surbl.org permanent test point'), $this->_surbl->getTxt( 'http://surbl-org-permanent-test-point.com/'. 'justatest' ) ); $this->assertTrue( $this->_surbl->isListed( 'http://wasdavor.surbl-org-'. 'permanent-test-point.com/justatest' ) ); $this->assertTrue($this->_surbl->isListed('http://127.0.0.2/')); $this->assertTrue($this->_surbl->isListed('http://127.0.0.2/justatest')); } /** * Tests if an URL that should not be spam is always correctly identified as * such. * * @return boolean true on success, false on failure */ public function testNoSpamUrlsNeverGetReportedAsSpam() { $this->assertFalse($this->_surbl->isListed('http://www.nohn.net')); $this->assertFalse($this->_surbl->isListed('http://www.php.net/')); $this->assertFalse( $this->_surbl->isListed( 'http://www.heise.de/'. '24234234?url=lala' ) ); $this->assertFalse($this->_surbl->isListed('http://www.nohn.net/blog/')); $this->assertFalse($this->_surbl->isListed('http://213.147.6.150/atest')); $this->assertFalse( $this->_surbl->isListed( 'http://www.google.co.uk/search'. '?hl=en&q=test&btnG=Google+Search&meta=' ) ); } /** * Tests if a set of spam and no-spam URLs is always correctly identified as * such. * * @return boolean true on success, false on failure */ public function testMixedSpamAndNospamUrlsWorkAsExpected() { $this->assertFalse($this->_surbl->isListed('http://www.nohn.net')); $this->assertTrue( $this->_surbl->isListed( 'http://surbl-org-permanent'. '-test-point.com' ) ); $this->assertTrue( $this->_surbl->isListed( 'http://surbl-org-permanent'. '-test-point.com/justatest' ) ); $this->assertTrue($this->_surbl->isListed('http://127.0.0.2/justatest')); $this->assertFalse($this->_surbl->isListed('http://213.147.6.150/atest')); $this->assertFalse($this->_surbl->isListed('http://www.php.net')); $this->assertFalse($this->_surbl->isListed('http://www.google.com')); $this->assertFalse( $this->_surbl->isListed( 'http://www.google.co.uk/search'. '?hl=en&q=test&btnG=Google+Search&meta=' ) ); } /** * Tests if invalid arguments always return false. * * @return boolean true on success, false on failure */ public function testInvalidArguments() { $this->assertFalse($this->_surbl->isListed('hurgahurga')); $this->assertFalse($this->_surbl->isListed(null)); $this->assertFalse($this->_surbl->isListed(false)); $this->assertFalse($this->_surbl->isListed(true)); } /** * Test encoded URLs are looked up correctly * * @return boolean true on success, false on failure */ public function testEncodedUrls() { $this->assertTrue( $this->_surbl->isListed( 'http://%73urbl-org-permanent'. '-test-point.com/justatest' ) ); } } ?>