Now there is a new update, a new methodology, how to make the web page update it self , more specific how to make a specific item on the page to be updated individually .
i asked many web engineers but no pure answer til i found that fantastic page
Simple and intuitive web interface for your Raspberry Pi
some of important lines mentioned in this article
- Programming an app for each OS (IOS, Android, Windows phone, Mac, Linux, Windows,...) would be too long and would require to know a lot of different languages for nearly nothing. It would also require to do an application running on the Raspberry Pi. Making it this way would be overkill and time wasting.
- That's why a website is the best solution, it's compatible with all devices and you "only" need to know four languages: HTML (for the page's skeleton), CSS (page's style), PHP (interactions with the server) and JavaScript (interactions with the user).
- disabled the start up code for regenerated HTML page , no need for it .
- changed my code from "bash with HTML" to "HTML with PHP included bash commands " and created new file "index.php".
the core PHP command used to run command line - used this command to enable the PHP code to read from processor (problem solution)
sudo usermod -G video www-data - then reboot the raspberry pi and delete the file "index.html" from folder "/var/www".
1
2
3
|
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";?>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?php
/*
* index.php
*
* Copyright 2015 Eng Mohamed Soubhi <>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>RPi-Soubhi php test</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 1.24.1" />
</head>
<body bgcolor="#122C2C" text="#25DC10">
<center>
<h1> * RPi-Soubhi * </h1>
<?php
$temperature = shell_exec('vcgencmd measure_temp');
echo "<pre>CPU $temperature</pre>";
?>
<?php
$volts_core = shell_exec('vcgencmd measure_volts core');
echo "<pre>Core $volts_core</pre>";
?>
<?php
$Global_IP = shell_exec('curl icanhazip.com');
echo "<pre>Global IP $Global_IP</pre>";
?>
<?php
$output = shell_exec('gpio readall');
echo "<pre>$output</pre>";
?>
<a href="./html_trial.html"><p>hiberlink</p></a>
<?php echo "Updated on ".date('Y-m-d H:i:s')." by Raspberry pi"; ?>
</center>
</body>
</html>
|
No comments:
Post a Comment