SEND TO HTML PAGE AT PARTICLE PHOTON WITH GET REQUEST


#1

hello, my goal is to send a get request from a html page to particle photon.
I created my page with get request in its url, now I installed the drivers for the particle photon of zerynth and I set the parameters of the wifi.
I’m testing the example mini web server. Zerynth connects but I don’t understand why it remains in “Waiting for Connections” in the while cycle.
I have to set something in html page?
I put the url of my page somewhere?
I am a beginner who can help me? thank you


#2

Hi luiss,
the Mini Web Server example is thought to work this way:
 - connect your photon to your wifi network
 - open your browser at the local ip shown in the console, getting a message from your board

are you sure you want to send a GET request from a web page to your particle photon?
First of all you should make your photon reachable from outside your LAN (if your web page is not hosted as a local web page).
Which address are you currently using to send the request? :slight_smile:



#3

 I have to create a website (for now I have only one page html), from which to send the request of values taken from sensors attached to the particle photon.
This is my page:
http://sistemaallagamento.altervista.org/dati.html
How can I make the photon searchable from the outside?




#4
i open my browser at the local ip shown in the console, getting a error message:
Unable to connect.
What should I set up?




#5

Hi luiss,
what you need to do is to open a port in your local router configuration and bind it to a local ip address.
(example: http://www.computerhope.com/issues/ch001201.htm)
You can choose to reconfigure your router with a new device ip every time it connects to your wifi or specify a static local ip for your board.
Have you considered making your device send acquired data instead of letting a webpage asking for them?


#6

no I have not considered this as they are at the beginning of creation.
How could I making my devices send data acquired?
you advise me this choice? Then how could I take the data of the particle photon from my webpage?
Thanks


#7

I have tried to run everything said in the tutorial but I can not connect to my ip address of the page to make a connection with the photon, what can I do? there is another way to connect to the photon?
@LorenzoR


#8

i am getting confused  :wink:
@luiss what are you trying to do? Do you want to create a webpage that shows data acquired by a Photon? Where the webpage have to be hosted?

With Zerynth you can:

  1. create a minimal webpage that is exposed directly by the Photon on which the data acquired are reported (this is described in the example suggested by @LorenzoR ). this page will be reachable by pointing to the Photon local IP address from inside your local network. If you want to have your page reachable from outside your local network you have to configure your router to redirect packets for the port:80 to the internal IP associated with the Photon. in this second case the page would be reachable by pointing to your modem assigned public IP; 
  2. Create a webpage on a server located outside your local network and retrive the data you want to plot from a photon located on a local network using a GET request. in this case things are bit more complicated and, as said by @LorenzoR, first of all you need to make your Photon reachable from outside your local network by using some specific port.
please help us to better understand what you have in mind and we will be glad to support you in detail.

#9

I should do the second option, create a webpage on a server located outside my local network and retrive the data from a photon located on a local network using a GET request.
If I can not do this option, I might reconsider this idea and implement the first option, by realizing it in order to access from the outside to the photon data.
This is the project for my thesis, the idea is to access the photon from outside the local network data, so you tell me which option is more feasible.

I hope I was clear,thanks
@floyd


#10

Hi luiss,
the easiest thing you can do is to make your Photon acquire data and send them to an external “data collector” which will be polled by your web page to show collected data, avoiding the necessity of exposing your board to the web.
For example you could write a simple php script receiving board ID and data (sent by the board) and saving them in a database, your web page would then be able to show data stored in the database.
This way, on the board, you  would need only a request easily done through the request module (the best way would be a POST with id and data fields, but since POST requests are not currently supported you could go with a GET)


#11

I agree with you, I was able to connect to the ip of photon, writing the ip in the browser.
Now I would like to understand how to direct my simple page html or php to the ip address of the photon , so as to send the request get.
The database I should associate with html or php page?
thank you


#12

@LorenzoR