Particle Making Get Request to Local IP

Hello,

I have particle photon dev board.
I want it to connect my wifi and make get request to local website for example:

192.168.1.103/test.html

i cant make it with webhook. Im trying to use HttpClient library but i cant make it work.

How can i make simple get request to html file hosted in local intranet.

Thanks for your advises.

What have you tried so far?

in header part of code im sending:

http_header_t headers[] = {
 { "Content-Type", "text/html" },
 { "Accept" , "*/*"},
 { NULL, NULL }  
  };

and host configuration:

request.hostname = "http://192.168.1.106";
request.port = 80;
request.path = "/";

requested adress is returning html.

When i look result from serial monitor it is:

Response status: -1

Try dropping the protocol prefix “http://” as this is not part of the host name.
If this doesn’t help, try setting the IP address as IPAddress is this is also not a host name.

request.ip = IPAddress(192,168,1,106);
2 Likes

Hello ScruffR,

Thanks for your reply. You saved my time. I tried as you said and its worked.

2 Likes