Adds method to ping Bridge
This commit is contained in:
@@ -26,6 +26,8 @@ class Bridge {
|
||||
const CHECK_ERROR_UNAVAILABLE = 503;
|
||||
const CHECK_ERROR_UNKNOWN = 'unknown';
|
||||
|
||||
const BRIDGE_URL = 'https://bridge.mailpoet.com';
|
||||
|
||||
public $api;
|
||||
|
||||
static function isMPSendingServiceEnabled() {
|
||||
@@ -48,6 +50,15 @@ class Bridge {
|
||||
return !empty($key);
|
||||
}
|
||||
|
||||
static function pingBridge() {
|
||||
$params = array(
|
||||
'blocking' => true,
|
||||
'timeout' => 10
|
||||
);
|
||||
$result = wp_remote_get(self::BRIDGE_URL, $params);
|
||||
return wp_remote_retrieve_response_code($result) === 200;
|
||||
}
|
||||
|
||||
function initApi($api_key) {
|
||||
if($this->api) {
|
||||
$this->api->setKey($api_key);
|
||||
|
Reference in New Issue
Block a user