I have a need to obtain WiFi signal strength on a Pi0W.
I have a PHP script and all works via terminal:
php /var/www/html/blah.php (I use
exec("iwconfig wlan0", $output_lines);)
The script runs as a cron job.
Basically, cron launches
curl every 5 minutes to send a ping to another server (this part works). I
JSON data which gets processed on the server. This used to be a static .json file. Now I generate my
JSON data on the fly and want/need to include some additional data with it.
The command launched by cron:
curl -d "`php /var/www/html/generate_json.php`" -X POST https://myserver/json_logger.php
JSON data generates fine, but I am having trouble retrieving the result of
The funny thing is when I run the
php part in a terminal, it gets the data fine (kind of expected). I also checked
whoami and I am "pi" (as expected).
When the command is launched by cron, it is also launched by "pi" user; however, as I stated above, the result of
iwconfig is blank.
As I understand, this is most likely a permissions issue, but I am not sure exactly what/where to change.
If there is another way to obtain WiFi information, I am open to options.