public function call($method = false, $post_params = false)
{
$cookie = mw_cache_path() . DIRECTORY_SEPARATOR . 'cookies' . DIRECTORY_SEPARATOR;
if (!is_dir($cookie)) {
mkdir_recursive($cookie);
}
$cookie_file = $cookie . 'cookie.txt';
$requestUrl = $this->remote_url;
$post_params['site_url'] = $this->app->url_manager->site();
$post_params['api_function'] = $method;
$post_params['mw_version'] = MW_VERSION;
if ($post_params != false and is_array($post_params)) {
$curl = new \Microweber\Utils\Http($this->app);
$curl->set_url($requestUrl);
$curl->set_timeout(10);
$curl_result = $curl->post($post_params);
} else {
$curl_result = false;
}
if ($curl_result == '' or $curl_result == false) {
return false;
}
$result = false;
if ($curl_result != false) {
$result = json_decode($curl_result, 1);
}
return $result;
}