Hi all!
I'm new at the NeoBook and try a new function.
I have this small ethernet board: http://www.ebay.com/itm/371368344640?_t ... EBIDX%3AIT
The default IP link is a flllowing: http://192.168.1.4/3000
On this page appear 8 text link to toggle the outputs.
To switch on the output 1 from web browser: http://192.168.1.4/30000/01
To switch off the output 1 from web browser: http://192.168.1.4/30000/00
If put these link a web browser the output 1 working. But after a redirect executed and the main page appear: http://192.168.1.4/30000
How to make a simple POST command in NeoBook for these functions?
Sorry for the question and the bad english, i'm absolute beginner
Thank you.
Karcsi
Web Relay controll
Moderator: Neosoft Support
Re: Web Relay controll
Have you tried InternetPost fuction?
Code: Select all
InternetPost
Purpose : Send an HTTP command and data to an Internet server. The response from the server will be stored in the supplied variable.
Category : Internet
Syntax : InternetPost "url" "data" "variable" "options"
url
The url that will receive the post command.
data
Additional data (if any) to send to the server. The formatting requirements for this data is highly server and application specific.
variable
The name of the variable to store the server’s response.
options
Enter "Async" here to allow NeoBook to respond to other input while waiting for the server to reply. Leave this parameter blank to suspend user input until the action is complete.
Example : SetVar "[Host]" "http://www.yoursite.com/test.php"
SetVar "[Data]" "fname=Larry&lname=Morton"
InternetPost "[Host]" "[Data]" "[Result]" "Async"
Re: Web Relay controll
Sorry for the delayed reply. I working hard.
Yes, tried the InternetPost function with variable mode to http://192.168.3.221/30000/01
(with option data send and without).
Not working.
A message received from the modul. This message: Fail to change the IP & port.
This weird, because the IP & port changing url: http://192.168.3.221/30000/42
Code for the button Left Click (i tried with fill data fieldon other case):
InternetPost "http://192.168.3.221/3000/01" "" "[post]" "Async"
I add a textbox, and the General tab add this: [post]. Where receive the message.
Does not work....
Yes, tried the InternetPost function with variable mode to http://192.168.3.221/30000/01
(with option data send and without).
Not working.
A message received from the modul. This message: Fail to change the IP & port.
This weird, because the IP & port changing url: http://192.168.3.221/30000/42
Code for the button Left Click (i tried with fill data fieldon other case):
InternetPost "http://192.168.3.221/3000/01" "" "[post]" "Async"
I add a textbox, and the General tab add this: [post]. Where receive the message.
Does not work....
Re: Web Relay controll
johnycorp:
I searched the internet for documentation about interacting with the ENC28J60 Network Module 8-Channel Network Controller but did not find any.
When you said that ...
If you typed it, then that qualifies as a GET method ... perhaps you need to use the InternetGet command in NeoBook ... so try ...
Note1: To be safe, include the ! before the http:
Note2: To make sure that you know when the command is responded to, do NOT specify the Async option
Are you in possession of documentation which specifies what method is to be used to communicate with the server software on the board ?
I searched the internet for documentation about interacting with the ENC28J60 Network Module 8-Channel Network Controller but did not find any.
When you said that ...
... did you achieve this by typing the above values in the address box of your Browser ... or was this request POSTed from some javascript/form inside an html document ?To switch on the output 1 from web browser: http://192.168.1.4/30000/01
To switch off the output 1 from web browser: http://192.168.1.4/30000/00
If you typed it, then that qualifies as a GET method ... perhaps you need to use the InternetGet command in NeoBook ... so try ...
Code: Select all
InternetGet "!http://192.168.1.4/30000/01" "[OnResult]" ""
AlertBox "Response" "[OnResult]"
and
InternetGet "!http://192.168.1.4/30000/00" "[OffResult]" ""
AlertBox "Response" "[OffResult]"
Note2: To make sure that you know when the command is responded to, do NOT specify the Async option
Are you in possession of documentation which specifies what method is to be used to communicate with the server software on the board ?
Re: Web Relay controll
Thanks for help stu!
And big thanks Gaev!
The InternetGet method working good. I make the app.
Only small design editing remain.
See the attached images
Only a problem remain.
On attached image appear this: webio_status.png
I want the get the string (marked red), because these numbers have status of output 1-8.
What sould be the solution this?
http://www.mediafire.com/view/hz0msl5s1 ... o_edit.png
http://www.mediafire.com/view/ai38mvcbt ... o_main.png
http://www.mediafire.com/view/qi479bm4t ... status.png
And big thanks Gaev!
The InternetGet method working good. I make the app.
Only small design editing remain.
See the attached images
Only a problem remain.
On attached image appear this: webio_status.png
I want the get the string (marked red), because these numbers have status of output 1-8.
What sould be the solution this?
http://www.mediafire.com/view/hz0msl5s1 ... o_edit.png
http://www.mediafire.com/view/ai38mvcbt ... o_main.png
http://www.mediafire.com/view/qi479bm4t ... status.png
Re: Web Relay controll
johnycorp:
1) the text in black with a grey background (directly above the button labelled Get Relay Status) is what is being returned from a command like ...
2) You want to know how to extract the 16 digits of information that you have enclosed in the red coloured rectangle
If this is so, you will need to use the StrParse and SubStr commands ... assuming the returned text is in variable called [StatusResult] ...
If my understanding is incorrect, please elaborate on your needs.
Tell me if my understanding of your enquiry is correct.Only a problem remain.
On attached image appear this: webio_status.png
I want the get the string (marked red), because these numbers have status of output 1-8.
What sould be the solution this?
1) the text in black with a grey background (directly above the button labelled Get Relay Status) is what is being returned from a command like ...
Code: Select all
InternetGet "!http://192.168.1.4/something/or/other" "[StatusResult]" ""
If this is so, you will need to use the StrParse and SubStr commands ... assuming the returned text is in variable called [StatusResult] ...
Code: Select all
StrParse "[StatusResult]" "!>" "[ResultPart]" "[ResultPartsCountcount]"
... now the first 16 characters of [ResultPart2] will contain the desired data
SubStr "[ResultPart2]" "1" "16" "[StatusOfAll8Ports]"
... all 16 digits are now in [StatusOfAll8Ports]
SubStr "[ResultPart2]" "1" "2" "[StatusOfPort1]"
... status of port 1 is now in [StatusOfPort1]
SubStr "[ResultPart2]" "3" "2" "[StatusOfPort2]"
... status of port 2 is now in [StatusOfPort2]
etc. etc.
Re: Web Relay controll
Gaev:
Yes, this solution working!
Thank you!
I used the code in this format:
Thanks again for the help!
Have a nice weekend!
Yes, this solution working!
Thank you!
I used the code in this format:
Code: Select all
InternetGet "http://[IPAddress]/[PortNumber]/99" "[StatusResult]" ""
... Used the previously defined variables
StrParse "[StatusResult]" "!00000000[#34]>" "[ResultPart]" "[ResultPartsCountcount]"
... !00000000[#34]> result the correct string.
... now the first 16 characters of [ResultPart2] will contain the desired data
SubStr "[ResultPart2]" "1" "16" "[StatusOfAll8Ports]"
... all 16 digits are now in [StatusOfAll8Ports]
SubStr "[ResultPart2]" "1" "1" "[StatusOfPort1]"
... status of port 1 is now in [StatusOfPort1]
SubStr "[ResultPart2]" "3" "1" "[StatusOfPort2]"
... status of port 2 is now in [StatusOfPort2]
Have a nice weekend!