Number of visitors to a website, http or https requests

Viewed 49

I'm having trouble finding information about this, some help please...

I'm looking for a way to know how many visits I have on a website. I wouldn't like to use google analytics. Do I have a way to get this information? straight from the server, maybe some PHP function.

I'm working on cpanel Linux Godaddy hosting

Thanks in advance! Marce

On cpanel>metrics found visitors and other metrics, I need a way to get the number so I can store in my database...

Or the other way I solved and this my code so far, as a counter for every time someone visits index. I like this solution so counter won't change if browser refresh

include("conex.php");
session_start();
if(empty($_SESSION['visited'])){
    //$counter = file_get_contents('./count.txt') + 1;
    //file_put_contents('./count.txt', $counter);
    mysqli_query($mysqli, "UPDATE metrics SET visits=visits+1 WHERE cod=0");
}

$_SESSION['visited'] = true;

Got the idea from: PHP only Hit Counter?

Here a .txt file is create, so I need to extract that data, how? I suppose the best way is using the metrics information on cpanel as @mplungian suggested, as it is already there

0 Answers
Related