public function download($save_to_file, $post_data = false)
{
if ($save_to_file != false) {
$dn = dirname($save_to_file);
if (!is_dir($dn)) {
mkdir_recursive($dn);
}
if (is_dir($dn)) {
$this->save_to_file = $save_to_file;
if ($post_data != false) {
$ex = $this->post($post_data);
$this->save_to_file = false;
return $ex;
} else {
$ex = $this->execute($post_data);
$this->save_to_file = false;
return $ex;
}
}
}
$this->save_to_file = false;
}