$siteDomain, 'p' => $path, 't' => 'pageview', )); $headers = array( 'Content-Type: application/json', 'X-Snorklee-Server: php/1', ); if ($ip !== '') { // En-tête DÉDIÉ : X-Forwarded-For est réécrit par chaque proxy // traversé. Les deux sont envoyés pour rester compatible avec les // installations qui n'ont pas encore mis à jour ce fichier. $headers[] = 'X-Snorklee-Crawler-IP: ' . $ip; $headers[] = 'X-Forwarded-For: ' . $ip; } if (!function_exists('curl_init')) { return; } // Fire-and-forget : timeout court, on n'attend pas la réponse. $ch = curl_init(rtrim($dashboardUrl, '/') . '/api/event'); curl_setopt_array($ch, array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body, CURLOPT_HTTPHEADER => $headers, CURLOPT_USERAGENT => $ua, // UA ORIGINAL du crawler (analysé par le backend). CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT_MS => 300, CURLOPT_CONNECTTIMEOUT_MS => 200, CURLOPT_NOSIGNAL => true, )); // Un échec ne doit jamais casser la page : on ignore le résultat. @curl_exec($ch); curl_close($ch); } }