The purpose of this code is to pull upgrade.zip from a central server, extract it and place it in a folder on the resident server. I get no errors, it just results in the die("!There was a problem. Please try again!");
require('../../../wp-blog-header.php');
function openZip($file_to_open) {
global $target;
$zip = new ZipArchive();
$x = $zip->open($file_to_open);
if($x === true) {
$zip->extractTo($target);
$zip->close();
unlink($file_to_open);
} else {
die("!There was a problem. Please try again!");
}
}
$payload = file_get_contents('http://myserver.com/upgrade.zip');
if(isset($payload))
{
$filename = 'upgrade.zip';
$source = file_get_contents('http://myserver.com/upgrade.zip');
$target = ABSPATH.'wp-content/themes/mytheme/';
// permission settings for newly created folders
$chmod = 0755;
$saved_file_location = $target . $filename;
openZip($saved_file_location);
}