Warning

The Coralogix PHP SDK will End of Life(EOL) Feb 1st 2024.
For PHP 7.4+, please use the Coralogix’s PHP OpenTelemetry Instrumentation Documentation instead.

HttpSender

class Coralogix\HttpSender
Class HttpSender
HTTP sender for Coralogix logger
Parent:

Thread

Properties

public property Coralogix\HttpSender::$timeout
Type:

int timeout of HTTP request (default=30s)

Methods

public static Coralogix\HttpSender::init(int $timeout)
Set parameters of HTTP sender
Parameters:
  • $timeout (int) timeout of HTTP request

public static Coralogix\HttpSender::send_request(array $bulk, string $url=\\Coralogix\\Constants::CORALOGIX\_LOG\_URL, int $retries=\\Coralogix\\Constants::HTTP\_SEND\_RETRY\_COUNT)
Send logs bulk via HTTP to Coralogix servers
Parameters:
  • $bulk (array) logs bulk

  • $url (string) url to send

  • $retries (int) retries count

Returns:

int response code

public static Coralogix\HttpSender::get_time_sync(string $url=\\Coralogix\\Constants::CORALOGIX\_TIME\_DELTA\_URL) array
Get time difference between local machine and Coralogix servers
Parameters:
  • $url (string) url to get servers time

Returns:

array result of execution and time difference