I have a hard time to compile your code on github for the arduino example.
Ok if I compile on "arduino ethernet" I get difference error then when I compile for "ESP8266 thing" from sparkfun.
github.com/appzer/arduino-pushsafer/blob/master/Pushsafer.ino
but before I start, should line #46 have the /api in the url?
Code: Select all
client.println("Host: https://www.pushsafer.com");
Code: Select all
client.println("Host: https://www.pushsafer.com/api"); <---- adding /API at the end of the URL?
is the length important? Can I not send it?
Code: Select all
length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();
Code: Select all
length = 30 + sizeof(message) + sizeof(title) + sizeof(sound) + sizeof(vibration) + sizeof(icon) + sizeof(device) + sizeof(url) + sizeof(urltitle) + sizeof(time2live) + sizeof(privatekey);
Code: Select all
https://www.pushsafer.com/api?k=your20characterPrivateKey&d=a&i=3&v=3&t=Sub&m=Message
Code: Select all
if(client.connect("pushsafer.com",80))
{
client.println("POST /api HTTP/1.1");
client.println("Host: https://www.pushsafer.com");
client.println("Connection: close\r\nContent-Type: application/x-www-form-urlencoded");
client.print("Content-Length: ");
client.print(length);
client.println("\r\n");;
client.print("k=");
client.print(privatekey);
client.print("&m=");
client.print(message);
client.print("&t=");
client.print(title);
client.print("&s=");
client.print(sound);
client.print("&v=");
client.print(vibration);
client.print("&i=");
client.print(icon);
client.print("&d=");
client.print(device);
client.print("&u=");
client.print(url);
client.print("&ut=");
client.print(urltitle);
client.print("&l=");
client.print(time2live);
Code: Select all
// pushsafer settings
char privatekey[] = "my code";
char message[] = "3D printer done printing";
char title[] = "title";
int sound = 1;
int vibration = 2;
int icon = 1;
char device[] = "a";
char url[] = "http://www.pushsafer.com";
char urltitle[] = "cest le site";
int time2live = 60;
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
thanks!!
I am on Arduino 1.8.0