Author Topic: changing port values without loading the webpage  (Read 3056 times)

hans

  • Newbie
  • *
  • Posts: 2
    • View Profile
changing port values without loading the webpage
« on: January 19, 2008, 11:27:45 AM »
Hi,

I received my webboard today and am playing arround a bit.
Already managed to set some port values within my network. C
I want to build an (external) homepage with knobs that change pin values on the SBC board at home.
Is it possible to send commands to the SBC board (in http) without getting the internal web page loaded ?
(i want to remain in my homepage)

Kind regards,

Hans

sparkcatcher

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Re: changing port values without loading the webpage
« Reply #1 on: January 20, 2008, 08:49:20 PM »
I don't know if this will work for you, but you can send commands directly to the sbc boards by sending an http command similar to this:

http://[ip address]/somepage.cgi?u=admin&p=pw&pincommandn=1&pincommandm=0

where somepage.cgi is a page that you develop, it could provide a status of the pins to ensure they are set because the commands in the url are processed before the page is sent back.

You have to look through the modtronix documentation to get the actual command names for the pins and for the user and password.  I believe you have to send the user and password which essentially logs you in (using the current code) before it will process I/O changes.

This will however send a page back to your server, however if you are working with say PHP on your server you should be able to send out this command, if the command is properly formatted you should receive the page back, and then you could deliver an updated page to your browser based on the results provided in the page.

spark

hans

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: changing port values without loading the webpage
« Reply #2 on: January 22, 2008, 03:30:32 PM »
Hi,

Unfortunally my current webhost does not support any scripting except java.

So tried the following:
1. create button in html page with a link to the html command. -> it works, but SBC webpage is loaded.
2. create link in html page which posts the resulting page into hidden iframe -> it works but i suffer from IE page cache memory so i might have to press the link a few times before it will activate the code again.
3. programmed buttons in java which send an UDP command. -> works just fine in the java compiler enviroment. (until i put this java class script in my html...then it fails to run)

You have a point that i need to check the actual status after a command has been send.
Maybe i need to change to a webhost which supports cgi.....





niroblock

  • Hero Member
  • *****
  • Posts: 140
    • View Profile
Re: changing port values without loading the webpage
« Reply #3 on: January 23, 2008, 05:27:41 AM »
Hi huns,

No! No! No!

Language script server side can not be blocked by a browser, because the script is interpreted gives the server and not on the client browser

Example of a service standard with PHP script

          SERVER                                                    CLIENT
   
    $getvar = $ _GET ("G");                  <-              test.php?G=1
   
    If ($getvar == 1)
    {
       $val1 =  2;
       $val2 =  2;
                                                       -->            4
       echo $val1 + $val2;

    }

Example of a service standard with Stack Microchip 
   
     
   int readHTTPcmd(char var, int val)
   {
     If (var == 'G') {                       <-              test.cgi?G=1
      If (val == 1) {
             
          int val1 = 2;
          int val2 = 2;
           Return val1 + val2;
         
       }
     }

    SendtoBrowser(readHTTPcmd('G',1));     ->   4


As you see in both cases, the browser does nothing more than print the result envoy gives the server


Otherwise: the mine type (. CGI = text / html) (. HTML text / html) is a parameter that authorizes the server and not the browser



Proof-read and implement this code and really how it works!

HTTP send comand

HTTP read value (with ajax)


byee.
« Last Edit: January 23, 2008, 05:48:15 AM by niroblock »
do not make any questions, if you already have the answer!