/**
* @throws InvalidConfiguration
*/
public function runMonitor()
{
if (empty($this->url)) {
throw InvalidConfiguration::noUrlConfigured();
}
try {
$guzzle = new Guzzle(['timeout' => $this->timeout, 'allow_redirects' => $this->allowRedirects]);
$response = $guzzle->get($this->url);
$this->responseCode = $response->getStatusCode();
$this->responseContent = (string) $response->getBody();
} catch (ClientException $e) {
$response = $e->getResponse();
$this->responseCode = $response->getStatusCode();
} catch (ConnectException $e) {
}
if ($this->responseCode != '200' || !$this->checkResponseContains($this->responseContent, $this->checkPhrase)) {
event(new HttpPingDown($this));
} else {
event(new HttpPingUp($this));
}
}