Hi, I added the following code to the file in cron.php in the api directory:
<?php
// Add correct path to your countlog.txt file.
$path = 'hits.txt';
// Opens countlog.txt to read the number of hits.
$file = fopen( $path, 'r' );
$count = fgets( $file, 1000 );
fclose( $file );
// Update the count.
$count = abs( intval( $count ) ) + 1;
// Output the updated count.
echo "{$count} hits\n";
// Opens countlog.txt to change new hit number.
$file = fopen( $path, 'w' );
fwrite( $file, $count );
fclose( $file );
?>
I also added the hits.txt file there
The code itself works, I checked.(in the public_html directory)
But when triggered by cron, should the counter in the hits.txt file be incremented, or will it not work?
currently the counter in the hits.txt file does not change.