<?php
// Check if current user is bot or not (really lame test... ;-) )
function is_bot() {
    
$isBot false;
    if ( ( isset(
$_COOKIE) ) && ( count($_COOKIE) > ) ) {
        
// Bots normally has no cookies...
        
$isBot true;
    }

    
// Return result
    
return $isBot;
}

function 
fetch_url($url) {
    
// Apply some filters here
    
$url apply_filter('fetch_url'$url);

    
// Let's download it from the server
    
include_once( ABSPATH "wp-includes/class-snoopy.php");
    
$client = new Snoopy();
    
$client->agent "WordPress on " get_option('siteurl');
    
$client->fetch$url );
    if ( 
$client->status == "200" || $client->status == "302" ) {
        
// Transfer the content
        
$content $client->results;
    } else {
        
// If not 200 or 302
        
$content $client->status;
    }

    
// Return the fetched content
    
return $content;
}

?>