Advertisements

akismet_check_server_connectivity

Definition:
function akismet_check_server_connectivity() {}

Source code

function akismet_check_server_connectivity() {

	global $akismet_api_host, $akismet_api_port, $wpcom_api_key;

	

	$test_host = 'rest.akismet.com';

	

	// Some web hosts may disable one or both functions

	if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') )

		return array();

	

	$ips = gethostbynamel($test_host);

	if ( !$ips || !is_array($ips) || !count($ips) )

		return array();

		

	$servers = array();

	foreach ( $ips as $ip ) {

		$response = akismet_verify_key( akismet_get_key(), $ip );

		// even if the key is invalid, at least we know we have connectivity

		if ( $response == 'valid' || $response == 'invalid' )

			$servers[$ip] = true;

		else

			$servers[$ip] = false;

	}



	return $servers;

}

9005

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: