Send a beacon to our server.

@return void
334963
public function send()
    {
        // We don't want any accidental sending of beacons if the installation has explicitly said no.
        if (!$this->enabled()) {
            return;
        }

        $setting = app(Setting::class);

        if (!$installId = $setting->get('install_id', null)) {
            $installId = sha1(Str::random(20));

            $setting->set('install_id', $installId);
        }

        $payload = [
            'install_id' => $installId,
            'version'    => CACHET_VERSION,
            'docker'     => $this->config->get('cachet.is_docker'),
            'database'   => $this->config->get('database.default'),
            'data'       => [
                'components' => Component::all()->count(),
                'incidents'  => Incident::all()->count(),
                'metrics'    => Metric::all()->count(),
                'users'      => User::all()->count(),
                'actions'    => Action::all()->count(),
                'tags'       => Tag::all()->count(),
                'schedules'  => Schedule::all()->count(),
            ],
        ];

        try {
            $client = new Client();
            $client->post(self::URL, [
                'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'],
                'json'    => $payload,
            ]);
        } catch (Exception $e) {
            event(new BeaconFailedToSendEvent());

            return;
        }

        event(new BeaconWasSentEvent());
    }
1126079
public function send()
    {
        // Check if headers are sent already.
        if (headers_sent() === false) {

            // Determine reason phrase
            if ($this->reasonPhrase === null) {
                $this->reasonPhrase = self::$messages[$this->statusCode];
            }

            // Send status code.
            header(sprintf('%s %s', $this->protocolVersion, $this->reasonPhrase), true, $this->statusCode);

            // Send headers.
            foreach ($this->headers as $header => $value) {
                header(sprintf('%s: %s', $header, $value), true, $this->statusCode);
            }

            // Send cookies.
            foreach ($this->cookies as $cookie) {
                setcookie($cookie['name'], $cookie['value'], $cookie['expire'],
                    $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
            }

            // Send body.
            echo $this->body;
        }

        return $this;
    }
416071
public function send()
    {
        if (!headers_sent()) {
            foreach ($this->cookies as $cookie) {
                $cookie->send();
            }

            return true;
        }

        return false;
    }
711791
public static function send()
    {
        $format = self::getResponseFormat();
        if ($format === 'unknown') {
            return;
        }

        if (count(self::$records)) {
            if ($format === 'html') {
                self::writeOutput('<script>' . self::generateScript() . '</script>');
            } elseif ($format === 'js') {
                self::writeOutput(self::generateScript());
            }
            self::reset();
        }
    }
902332
public function send() {
    list ($headers, $blob, $code) = $this->toHttp();
    header('Content-Type: ' . Constants::MIME_TYPE);
    header("X-PHP-Response-Code: $code", TRUE, $code);
    foreach ($headers as $n => $v) {
      header("$n: $v");
    }
    echo $blob;
  }
813615
public function send()
    {
        $providers = $this->providers;
        $messages = $this->messages;
        $this->unsetMessages();
        foreach ($messages as &$message) {
            foreach ($providers as $provider) {
                $message->using($provider)->send();
                if ($message->getStatus() == MessageStatus::STATUS_SENT) {
                    break;
                } else {
                    $this->addError($message->getError());
                }
            }
        }

        return $messages;
    }
796244
public function send()
    {
        $this->sendHeader();

        $body = $this->getBody();

        $body->rewind();

        echo $body->getContents();
    }
376659
private void sendHubHeartbeats()
  {
    RackHeartbeat rack = _rack;
    
    UpdateRackHeartbeat updateRack = rack.getUpdate();
    UpdatePodSystem updatePod = getUpdatePodSystem();
    
    long now = CurrentTime.currentTime();
    
    if (! isJoinComplete()) {
      updatePod = null;
    }

    // send hub update to all servers in the rack
    for (ServerHeartbeat rackServer : _rack.getServers()) {
      if (rackServer == null || rackServer == _serverSelf) {
        continue;
      }

      ServerTarget target = createTargetServer(rackServer);
      
      target.hubHeartbeat(getServerSelf().getUpdate(),
                             updateRack,
                             updatePod,
                             now);
    }
  }
1367832
public function send()
    {
        $this->sendHeaders();
        $this->sendContent();

        if (function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif ('cli' !== PHP_SAPI) {
            static::closeOutputBuffers(0, true);
        }

        return $this;
    }
83092
public function send()
	{
		$result = true;

		if ($this->isNew)
		{
			// make this cookie as used
			$this->isNew = false;

			// set the cookie
			$result = $this->wrapper->setcookie($this->name, $this->value, $this->config['expiration'], $this->config['path'], $this->config['domain'], $this->config['secure'], $this->config['http_only']);

			// mark the cookie as sent
			if ($result)
			{
				$this->isSent = true;
			}
		}
		elseif ($this->isDeleted)
		{
			// delete the cookie by nullifying and expiring it
			$result = $this->wrapper->setcookie($this->name, null, -86400, $this->config['path'], $this->config['domain'], $this->config['secure'], $this->config['http_only']);

			// mark the cookie as sent
			if ($result)
			{
				$this->isSent = true;
			}
		}

		return $result;
	}
1149554
private function sendBroadcast()
    {
        if (isset($this->inputs['action']) && trim($this->inputs['action']) == 'sendBroadcast') {
            $this->connectToWhatsApp();
            if (isset($this->inputs['message']) && trim($this->inputs['message'] !== '')) {
                $this->wa->sendBroadcastMessage($this->inputs['to'], $this->inputs['message']);
            }
            if (isset($this->inputs['image']) && $this->inputs['image'] !== false) {
                $this->wa->sendBroadcastImage($this->inputs['to'], $this->inputs['image']);
            }
            if (isset($this->inputs['audio']) && $this->inputs['audio'] !== false) {
                $this->wa->sendBroadcastAudio($this->inputs['to'], $this->inputs['audio']);
            }
            if (isset($this->inputs['video']) && $this->inputs['video'] !== false) {
                $this->wa->sendBroadcastVideo($this->inputs['to'], $this->inputs['video']);
            }
            if (isset($this->inputs['locationname']) && trim($this->inputs['locationname'] !== '')) {
                $this->wa->sendBroadcastPlace($this->inputs['to'], $this->inputs['userlong'], $this->inputs['userlat'], $this->inputs['locationname'], null);
            }
            exit(json_encode([
                'success'  => true,
                'data'     => 'Broadcast Message Sent!',
                'messages' => $this->messages,
            ]));
        }
    }
1254061
public static function send()
    {
        $instance = FirePHP::getInstance(true);
        $args = func_get_args();
        return call_user_func_array(array($instance,'fb'),$args);
    }
1264701
protected function send()
    {
//      reset of these properties each time when the database was queried
        $this->reset();

        $this->stmt = $this->pdo->prepare($this->query);
        if (! $this->stmt->execute($this->params)) {
            $this->setError(true);
        }
    }
1346272
public function send()
    {

        $this->ok = false;
// Try using curl if available
        if (function_exists('curl_init')) {
            $resp = '';
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $this->url);
            if (!empty($this->requestHeaders)) {
                curl_setopt($ch, CURLOPT_HTTPHEADER, $this->requestHeaders);
            } else {
                curl_setopt($ch, CURLOPT_HEADER, 0);
            }
            if ($this->method === 'POST') {
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request);
            } else if ($this->method !== 'GET') {
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->method);
                if (!is_null($this->request)) {
                    curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request);
                }
            }
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLINFO_HEADER_OUT, true);
            curl_setopt($ch, CURLOPT_HEADER, true);
            $chResp = curl_exec($ch);
            $this->ok = $chResp !== false;
            if ($this->ok) {
                $chResp = str_replace("\r\n", "\n", $chResp);
                $chRespSplit = explode("\n\n", $chResp, 2);
                if ((count($chRespSplit) > 1) && (substr($chRespSplit[1], 0, 5) === 'HTTP/')) {
                    $chRespSplit = explode("\n\n", $chRespSplit[1], 2);
                }
                $this->responseHeaders = $chRespSplit[0];
                $resp = $chRespSplit[1];
                $this->status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                $this->ok = $this->status < 400;
                if (!$this->ok) {
                    $this->error = curl_error($ch);
                }
            }
            $this->requestHeaders = str_replace("\r\n", "\n", curl_getinfo($ch, CURLINFO_HEADER_OUT));
            curl_close($ch);
            $this->response = $resp;
        } else {
// Try using fopen if curl was not available
            $opts = array('method' => $this->method,
                          'content' => $this->request
                         );
            if (!empty($this->requestHeaders)) {
                $opts['header'] = $this->requestHeaders;
            }
            try {
                $ctx = stream_context_create(array('http' => $opts));
                $fp = @fopen($this->url, 'rb', false, $ctx);
                if ($fp) {
                    $resp = @stream_get_contents($fp);
                    $this->ok = $resp !== false;
                }
            } catch (\Exception $e) {
                $this->ok = false;
            }
        }

        return $this->ok;

    }
1321174
public function sendHeaders()
    {
        if (!headers_sent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->getProtocolVersion(),
                    $this->getStatusCode(),
                    ($this->isOk() ? '' : $this->getReasonPhrase())
                ),
                true,
                $this->getStatusCode()
            );

            foreach ($this->header as $name => $value) {
                $name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
                header(sprintf('%s: %s', $name, implode(',', $value)), false, $this->statusCode);
            }

            foreach ($this->cookie as $cookie) {
                header(sprintf('Set-Cookie: %s', $cookie->asString()), false, $this->getStatusCode());
            }
        }
    }
424768
public function send()
    {
        // Send headers
        if (headers_sent() === false) {
            if (strpos(PHP_SAPI, 'cgi') === 0) {
                header(sprintf('Status: %s', $this->getReasonPhrase()));
            } else {
                header(sprintf('%s %s', $this->getProtocolVersion(), $this->getReasonPhrase()));
            }

            foreach ($this->headers as $name => $value) {
                foreach ($value as $hVal) {
                    header("$name: $hVal", false);
                }
            }
        }

        // Send body
        $this->body->seek(0);
        while ($this->body->feof() === false) {
            echo $this->body->read(1024);
        }

        return $this;
    }
1070186
public function send(): void
    {
        $body = $this->getBody();

        $this->sendCookies();

        switch (true) {
            case 'CLI' === $this->type:
                // no CLI response
                return;
            case null === $body:
            case StatusCode::NO_CONTENT === $this->getStatusCode():
                $response = new EmptyResponse($this->getStatusCode(), $this->getHeaders());
                break;
            case StatusCode::MOVED_PERMANENTLY === $this->getStatusCode():
            case StatusCode::FOUND === $this->getStatusCode():
                $response = new RedirectResponse(
                    $this->getHeader('Location'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'JSON' === $this->type:
                // JSON response
                // setup messages
                if (Messages::count()) {
                    $this->setHeader('Bluz-Notify', json_encode(Messages::popAll()));
                }

                // encode body data to JSON
                $response = new JsonResponse(
                    $body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'FILE' === $this->type:
                // File attachment
                $response = new AttachmentResponse(
                    $this->body->getData()->get('FILE'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'HTML' === $this->type:
            default:
                // HTML response
                $response = new HtmlResponse(
                    (string)$body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
        }

        $emitter = new SapiEmitter();
        $emitter->emit($response);
    }