Internet PLC Forum

General => Technical support => Topic started by: shoop_nl on January 27, 2011, 03:27:47 AM

Title: Control Nano-10 via external webserver
Post by: shoop_nl on January 27, 2011, 03:27:47 AM
Hi,

Is it possible to control the nano-10 via an external webserver.
For example I have on a webserver an aplication running with PHP and Via this website I want to give a start command to set an output via the PLC.

If yes, is there some example of this?
or maybe I need to include the PLCmon.jar applet to make this possible.
Title: Re:Control Nano-10 via external webserver
Post by: support on January 27, 2011, 09:18:36 AM
You can control the Nano-10 from a PHP server if you can issue a HTTP GET command. Nano-10 supports web query method using the /HOSTLINK/xxxxxx  command where xxxxxx is the actual host link command (refer to Chapter 16 of the User's Manual).

E.g. if the IP address of Nano-10 is 192.168.1.5:9080, you can turn on output #1 on the PLC from the browser address bar using the URL:

http://192.168.1.5:9080/HOSTLINK/Wb0100FF

(Of course this assumes that the output #1 is not under program control otherwise it will only be turned on for 1 scan time and the PLC program will update it back to its programmed status in the next I/O scan).

You should test the command in your browser and you will understand how to do it. After that it is a matter of coding your PHP server to send the HTTP GET command to the PLC.
Title: Re:Control Nano-10 via external webserver
Post by: shoop_nl on January 27, 2011, 02:30:28 PM
Thank you, Now I know how to use the HOSTLINK options to communicate. I can probably use a similar construction to check if the output was set. Assuming I will not get some kind of success back from the HTTP GET.
Title: Re:Control Nano-10 via external webserver
Post by: support on January 27, 2011, 04:07:19 PM
When you send GET /HOSTLINK/Wb0100FF the webserver will send you a HTTP response which you can check to ensure success. Of course you can also issue the /HOSTLINK/RO00 to read the output channel 0 (contains bits for output 1 to 8) to verify if it has been turned on. It is all up to your program.
Title: Re:Control Nano-10 via external webserver
Post by: shoop_nl on January 30, 2011, 06:53:03 AM
Ok I managed to create a hostlink library in my PHP frame work. But since I do not have my nano-10 yet, I was wondering if I can do some testing with the simulator in the studant package of the TL software. If yes how do I send a hostlink command to the simulator?
Title: Re:Control Nano-10 via external webserver
Post by: support on January 30, 2011, 08:51:16 PM
Unfortunately these are not simulated by TRiLOGI so you will have to wait for arrival of your Nano-10 PLC in order to test it.
Title: Re:Control Nano-10 via external webserver
Post by: shoop_nl on February 16, 2011, 12:12:46 PM
This works great, with the curl module of php enabled it is very easy to view and control settings on the nano-10