Help for send local URL

I want to send this URL from my Photon, via my local network ( or “power” represents a keyword.
If I send this URL through my web browser, it controls my TV box.

I installed the library HttpClient.h, I looked at the example but I do not see how to indicate my URL. Hostname, port, patch …?!?

Thanks for help

This sample shows how

For your case

    request.hostname = "";
    request.port = 80;
    request.path = "/pub/remote_control";

Or what else are you missing?

1 Like

Since this is a GET request, you can add the parameters right on the URL like this:

request.path = "/pub/remote_control?code=12345678&key=power";

Thanks but i’m already try this…

    // This #include statement was automatically added by the Particle IDE.
#include <HttpClient.h>

* Declaring the variables.
unsigned int nextTime = 0;    // Next time to contact the server
HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
    //  { "Content-Type", "application/json" },
    //  { "Accept" , "application/json" },
    { "Accept" , "*/*"},
    { NULL, NULL } // NOTE: Always terminate headers will NULL

http_request_t request;
http_response_t response;

void setup() {

void loop() {
    if (nextTime > millis()) {

    Serial.println("Application>\tStart of Loop.");
    // Request path and body can be set at runtime or at setup.
    request.hostname = "";
    request.port = 80;
    request.path = "/pub/remote_control?code=86700567&key=power";

    // The library also supports sending a body with your request:
    //request.body = "{\"key\":\"value\"}";

    // Get request
    http.get(request, response, headers);
    Serial.print("Application>\tResponse status: ");

    Serial.print("Application>\tHTTP Response Body: ");

    nextTime = millis() + 10000;

I use the Particle Web IDE, is this a problem ?

Does it work?
Does it not work?
If not, then what does it do?
What’s the serial output?

Have a close look what the difference is between your hostname and mine (or the one in the sample you copied the code from) :wink:


It does not work and do nothing !
I’m working with the Web IDE so, don’t have a serial monitor

How can I see the result of sending the request?

I just understood how to have the monitor serie;)
it says 1 time “: ok”

I found … you should not put “http: //” in the host
So, I found another library, simpler.

// This #include statement was automatically added by the Particle IDE.
#include "rest_client.h"

RestClient client = RestClient("");

void setup() {
String response;
void loop() {

  response = "";
  int statusCode = client.get("/pub/remote_control?code=86700567&key=power", &response);
  Serial.print("Status code from server: ");
  Serial.print("Response body from server: ");


I am proud of myself :wink:


Exactly that :+1: