// get user agent $user_agent = $_SERVER['HTTP_USER_AGENT']; // get content-type $content_type = $_SERVER['CONTENT_TYPE']; // get cookies $cookies = $_SERVER['HTTP_COOKIE']; // get referer $referer = $_SERVER['HTTP_REFERER']; // get accept language $accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$headers = getallheaders(); $user_agent = $headers['User-Agent']; $content_type = $headers['Content-Type']; $cookies = $headers['Cookie']; $referer = $headers['Referer']; $accept_language = $headers['Accept-Language'];The package library used for accessing request headers in PHP depends on the particular project or framework being used. Some popular choices include the Symfony HttpFoundation component, the Guzzle HTTP client, and the PHP League's HTTP package.