deviceMac = $deviceMac; } public function add(string $name, int|float $value): self { $this->data[$name] = $value; return $this; } public function send() { $data = array_merge($this->data, ['ID' => $this->deviceMac]); $ch = curl_init(self::API_ENDPOINT); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); $reply = curl_exec($ch); curl_close($ch); } }