A web server reader sends commands to an HTTP web server and reads its response.
To add a web server reader element to your model, drag the icon element to the list of your model elements and set the "Server address" field to the base URL of your server or link it to a String model variable (as in %myServerURLString%) that will contain it.
A web server reader element does not connect to the web server until you instruct it to do so (in any suitable part) in your model code.
A call to the element method String readOutput(String _command) will send the _command string appened to the server address and will read teh server's output. This makes it easy to send PHP commands to a given server or read different pages from the same server. The method returns a String with the server response to the command, or null if there was any error in the process.
A call to the element method String getServerAddress() returns the address actually used by the element.
You can also change the server address programmatically, using the method setServerAddress(String _serverAddress) . This sets the server address to a constant String (such as "http://www.um.es") or links it to a String model variable (such as "%myURLStringVariable%") which will need to provide the correct URL value.
Notice that the element will correct the URL of the final command sent to the server. For instance, spaces are replaced by the more correct %20 special character combination. Similarly, 'and' characters (&) are replaced by %26.
webReader.setServerAddress("http://www.um.es/fem/EjsWiki"); String responseStr = webReader.readOutput("/Site/EjsCurrentVersion?action=source"); if (responseStr==null) { _println("Could not read response from "+webReader.getServerAddress()); return; } _println("EJS current version is " + responseStr);