false, 'error' => 'notify_not_configured']; } $payload['app_key'] = $key; $url = rtrim($base, '/') . '/notify/send.php'; $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 20, CURLOPT_HTTPHEADER => ['Content-Type: application/json'], CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), ]); $resp = curl_exec($ch); $code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); $err = curl_error($ch); curl_close($ch); if ($resp === false) { error_log("notify_remote_send: transport error ($err) calling $url"); return ['ok' => false, 'error' => 'transport_error']; } $data = json_decode($resp, true); if (!is_array($data)) { error_log("notify_remote_send: bad response (HTTP $code) from $url: " . substr((string) $resp, 0, 300)); return ['ok' => false, 'error' => 'bad_response', 'http' => $code]; } if (empty($data['ok'])) { error_log("notify_remote_send: notify error (HTTP $code): " . ($data['error'] ?? '?')); } return $data; }