You are here

public static function CleantalkHelper::api_method__get_api_key in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7.4 src/CleantalkHelper.php \CleantalkHelper::api_method__get_api_key()

* Function gets access key automatically * *

Parameters

string website admin email: * @param string website host * @param string website platform * @return type

File

src/CleantalkHelper.php, line 320

Class

CleantalkHelper
Cleantalk's hepler class

Code

public static function api_method__get_api_key($email, $host, $platform, $agent = null, $timezone = null, $language = null, $ip = null, $do_check = true) {
  $request = array(
    'method_name' => 'get_api_key',
    'product_name' => 'antispam',
    'email' => $email,
    'website' => $host,
    'platform' => $platform,
    'agent' => $agent,
    'timezone' => $timezone,
    'http_accept_language' => !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null,
    'user_ip' => $ip ? $ip : self::ip_get(array(
      'real',
    ), false),
  );
  $result = self::api_send_request($request);

  // $result = $do_check ? self::api_check_response($result, 'get_api_key') : $result;
  return $result;
}