Back to

Custom backend


I’m currently working on the “SmartCitizen” Arduino board. i want to setup a custom backend. I used the same example as referred in the link

and cloned the git repository for the example

The curl command works for me, but when I try to send data using the board, it doesn’t work.

For your information,

  1. The board connects to the Wifii

  2. I can see the various sensor values on the serial terminal.

  3. I changed the WEB[] to

// Basic Server Posts to the SmartCitizen Platform - EndPoint:
static char* WEB[8]={
“PUT /add.php HTTP/1.1
"User-Agent: SmartCitizen
"X-SmartCitizenMacADDR: ",
"X-SmartCitizenApiKey: ",
"X-SmartCitizenVersion: ",
"X-SmartCitizenData: "};

Can you please help me out with this.

Hi @disssid,

It’s really nice you are trying to workout your own server.

Looking quickly at your example the only issue I see is you are using the wrong IP in your kit firmware.

Curl on works because means the loop back IP of your computer something as saying send this internally. Since your curl and your PHP server run on the same computer that is fine.

However when you want your kit to publish since your kit is a separate device on the network you will need to point to the kit to your local or public address. This means that if your kit and computer are on the same local network then you can point the kit to the computer local address. This might look as: or, etc.

This means the firmware will look something as:

static char* WEB[8]={ "", "PUT /add.php HTTP/1.1\ ", "Host: \ ", "User-Agent: SmartCitizen \ ", "X-SmartCitizenMacADDR: ", "X-SmartCitizenApiKey: ", "X-SmartCitizenVersion: ", "X-SmartCitizenData: "};

(“Host:” is not important if you are not running virtual hosts)

Hope this helps!

Keep us posted,