I would need to gather a list of all the user agents of the visitors of my website. Is that possible?
I essentially need a log like this:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36
$file = 'user_agents.txt';
$browser = $_SERVER['HTTP_USER_AGENT'] . "<br>";
file_put_contents($file, $browser, FILE_APPEND | LOCK_EX);
@HPierce was right, the problem was just that my webserver wasn't running PHP.