private function registerMwClient()
{
$key = Config::get('app.key');
$client = new \Guzzle\Service\Client('https://login.microweber.com/api/v1/client/');
$domain = site_url();
$domain = substr($domain, strpos($domain, '://') + 3);
$domain = str_replace('/', '', $domain);
$request = $client->createRequest('POST', "config/{$domain}");
//dd($request, $request);
$request->setPostField('token', $key);
$response = $client->send($request);
if (200 == $response->getStatusCode()) {
$body = (string) $response->getBody();
$body = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $body, MCRYPT_MODE_ECB);
$body = trim($body);
$body = (array) json_decode($body);
Config::set('services.microweber', $body);
Config::save(array('microweber', 'services'));
save_option(['option_value' => 'y', 'option_key' => 'enable_user_microweber_registration', 'option_group' => 'users']);
} else {
// $reason = $response->getReasonPhrase();
// dd(__FILE__, $reason, $response->getStatusCode());
}
}