Update the database from extern


I am using nextcloud out of the debian stretch repos, and I like it very much.

Is it possible that from an external PC, for example in our local network I run

sudo -u www-data php /var/www/html/nextcloud/occ files:scan --all

without logging me on the machine with ssh?

how could I program this in a php file I could launch from the external PC?

Or it there maybe an extension for it?

thanks in advance,
007 spy :wink:

I made this file.php

<?php $output = shell_exec('php /var/www/html/nextcloud/occ files:scan --all'); echo "
"; ?>

it works, but is there a more elegant way to do it?