
ELKOR TECHNOLOGIES INC.
- Page 20 -
MCM
–
USER MANUAL
2.
Click the
Change
button next to the
Posting
field.
3.
Click the
Preconfigured Profiles
drop-down box, and select
Elkor Cloud
.
4.
Check the
Enable Posting
checkbox.
5.
Click the
Submit
button.
6.
If you have not yet created an Elkor Cloud account, click the
create a new account
link.
7.
Click the
Add this device
link to add your device to your Elkor Cloud account. The Elkor Cloud site will prompt you
to login if necessary.
3.14.
Posting Data to your own Web Server
(Advanced Feature)
The device can periodically transmit data to a local or remote web site. This is done by sending an HTTP POST message
to a given URL (website address, such as http://www.your-server.com/). This message can be interpreted by server-side
scripts, such as those written in PHP, ASP, JSP, CGI, and similar technologies. Such scripts could log the information,
upload it to a database, control some other device with the information, and so on.
The format of the HTTP POST is customizable using a template. By default, the device ships with a template that posts in
JSON format, but by customizing the template, you could post in any other format, such as XML, CSV, or proprietary
formats specific to your company or organization. Details for customizing your template are provided in
While the details of server-side scripting are beyond the scope of this document, a sample script written in the PHP
scripting language is provided below for reference. The script reads the data from the HTTP POST and appends that data
to the end of the log file called
“
posts.log
”
.
<html>
<body>
<?php
// Place the contents of the HTTP POST into a variable
$postdata =
file_get_contents
(
"php://input"
);
// Save the data to a log file
$handle =
fopen
(
"posts.log"
,
"a"
);
fwrite
($handle, $postdata);
fclose
($handle);
?>
</body>
</html>
3.14.1.
Enabling Web Posting
To configure the web posting, you must access the web interface, and click on the
Web Posting
button on the left-hand
side of the page.
1.
In the Web Posting box, under the Current Posting Settings heading, click the
Change
button.
2.
Check the
Enable Posting
box.
3.
Choose how often the device will post its data to the server. To select, for instance, every 15 minutes, enter
“
15
”
into the text field, and select
“
minutes
”
from the drop-down box. You can enter times in minutes or hours.
4.
Enter the URL (web address) of the web server to which posts should be made.
Note
—
Trailing Slashes:
If the URL you are entering does not end in a file extension
(like .htm or .html), some web servers require that you end it with a trailing slash
/
. For
instance, http://www.your-server.com/data
/
5.
Click the
Submit
button to save your changes.
If the device previously had web posting disabled, it will immediately make its first post after the settings are applied, and
then make subsequent posts after the designated interval. You can test your configuration by clicking the
Post Now
button at the bottom of the Web Posting box.