Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
I am making some progress. In the blocks I am trying to send to “http://hambo.mynetgear.com:8085/file1”
It seems that I cannot add the port number 8085. Is thee a way to do this?
Without the port number, I cannot get through my router to my specific server.
Suggestion??
try this
see also the documentation to understand the properties...
http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web
SaveResponse
Whether the response should be saved in a file.
do the tutorials to learn the basics!
How to work with the web component and an API byStephen
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
I have the property page you reference in front of me but it is not very clear unless you have worked with web pages before.
When I try to use a URL with a port number, I get an error that it is an invalid URL. I do not see in the doc you suggest as to how to specify a port.
I want to get the response whatever it is so I can look for the string “file1”
If you use your computer and send to the URL http://hambo.mynetgear.com:8085/file1 you will get a response of “file 1 selected” This is what I want to achieve using MIT Inventor.
Taifun, any ideas for me about the port issue?
It doesn’t look like Stephen addressed the port issue.
If you change file1 to file2 you will get a different response.
I tried this, but did not get a response…
probably someone else has an idea?
Taifun
hambo.aia (2.0 KB)
I noticed that my server has responded to a request a few times so I guess the request is going out.
What my server does is to merely look at the received string and look for “file1” or “file2” then it responds with either “file1 selected” or file2 selected.
At least you are getting the app to send to a URL with a port number;
I am not sure why you cannot see the response.
Taifun, I tried the code (blocks) you posted and get no results. Not sure what is happening here. I am connecting to the ai companion on my cell phone.
Correction, your code blocks do work. My server crashed for some reason and I had to reboot it. Now your code works but still no response.
Are you testing with a cell phone or the emulator on the computer. I just tried the computer emulator and it worked although I have had to update it a few times.
I do appreciate you helping me with this.
It seems that we are sending the request but having trouble getting the “file 1 selected” response.
Hello Taifun… Are we giving up on this app?
If the fault is in the Arduino web server,
post the code for the Arduino web server.
I doubt that the problem is with the arduino server. It basically uses a library that creates the web server. When a request is received, the string “GET /file1” is searched for. If found, then the server merely returns the string “file 1 selected” to the client.
Would it be useful to use a tool in a browser like Chrome or Firefox to display the raw data that is received from the arduino. Maybe seeing the raw data will give a clue as to why the web component will not get the response. I have tried this and get a bunch of garbage and I cannot even see the “file 1 selected” response. The arduino sends a simple response but I do not know what other info is added by the arduino web server.
I just noticed that if the url is set to google.com. then there is what looks like raw data received. There is some preamble stuff that the web component does not accept. The google response has something like texxt/html; charset-iso-8859-1, and http//google.com, and 200, then a lot of data.
Maybe the web component requires a specific format. One would think that the raw data would be displayed in any event. It seems like the PC web browsers do not have a problem with what the arduino sends.
What url are you using to get a response back using a computer browser?
http://hambo.mynetgear.com:8085/file1
Does not work…
I thought I would finalize this thread.
The problem is with the web server software on the Arduino. As it turns out, the response header info was not being sent, i.e. “HTTP:1.1 200 OK”, and “Content-type:text/HTML”. My Firefox browser did not care about this header info so the desired response was received. Other browsers want the headers and create an error if not there. I still don’t know the exact procedure to make a good response but that is the issue. Thanks all.
thank you for letting us know...
Taifun