Baby monitor over the internet! web client help?

Hey there.

I just ordered my particle photon, and Im in the process of making a baby/sound monitor. So the way it’ll work is, I got this webpage ( which has 2 files. Index.php and update.php. Index.php reads 1 value from a database and outputs it in html and plays a sound if value is over a threshold yadayadayada… and update.php updates the database with whatever is in ?value=INT and then we’ll be able to read the page when we are walking the dog or whatever.

So my question is, how do I make the photon go to ? The majority of the code I can do myself. I’ll make a variable that holds the value from the pin, I’ll check the deviation from last time it was read, and if it’s greater than X I’d like the photon to “go to that page”.
I’ve done a little arduinoing before, but never anything internety, so a pointer/link in the right direction would be really helpful :-)!

Thanks in advance.

1 Like

Check out this post. There are links to 2 github repos by @rickkas7 which demonstrate streaming audio with the Photon over the internet.

1 Like

Thanks for the reply ninjatil. But Im not looking to stream audio. Im just looking to update my mysql database by running a script on my server. I just need the photon to go to my webpage, like you would in a normal browser. This is the code Im toying with to get it to work if that gives any indication of what Im trying to do:

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

http_header_t headers[] = {
    { "Accept" , "*/*"},
    { NULL, NULL }

http_request_t request;
http_response_t response;

void setup() {


void loop() {
request.hostname = "";
request.port = 80;
request.path = "";
request.body = "";, response, headers);

Is this an HTTPS or HTTP address?
If the former you’ll need to use webhooks - however even with HTTP I’d also go that way.

But if you can run your own server on that site, you could have a look at these two approaches

Thanks for the help. But I found a much simpler approach with TCPClient. It is my own on-site server.

Gonna try to close the thread if that’s a thing :wink:

In addition to what @ScruffR says, why do you have the path within the hostname? Why not something like this:

char[255] myPath;
int myVolume = 0;

void loop() {
 myVolume = [read from Photon pins or something];
 snprintf(myPath,sizeof(myPath), "/babyalarm/update.php?decibel=%d", myVolume)

 request.hostname = "";
 request.port = 80;
 request.path = myPath;
 request.body = "";
 http.get(request, response, headers);
1 Like

If you got the solution you can mark the post that shows the solution by clicking this icon image at the bottom of that post

Oh and @ScruffR asked about HTTPS because it’s not (reasonably, or easily) possible to make HTTPS requests directly from the Photon… for that you should use a webhook. But if local on your own network, and you don’t care about data security while in-transit, then the HTTPClient library will work fine.

1 Like