arduino pushsafer can't compile

Pushsafer make it easy and safe to get push-notifications in real time on your Android or Windows mobile device, iPhone, iPad and Desktop!

Mit Pushsafer kann man in Echtzeit, einfach und sicher, Push-Benachrichtigungen auf sein iPhone, iPad, Android oder Windows Gerät sowie auf den Desktop senden lassen!

======================
Google Play
App Store
Windows 10 Store
Homepage
User avatar
admin
Site Admin
Posts: 590
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: arduino pushsafer can't compile

Postby admin » 8. Jan 2017, 20:04

Content lenght is not the problem

out of the box arduino does not seem to support secure connections over https.
http://stackoverflow.com/questions/1583 ... ps-support

Please try to replace https://www.pushsafer.com to http://www.pushsafer.com

Otherwise you have to use a third party library for secure connections:
http://stackoverflow.com/questions/1113 ... on-arduino
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 8. Jan 2017, 20:17

ok check this out.
When I write

Code: Select all

client.println("Host: http://www.pushsafer.com");
I get error message 'bad request'

BUT when I write

Code: Select all

client.println("Host: www.pushsafer.com");
I get no message at all. Just "Connected"



to make sure http works, I use your code generator like this

Code: Select all

http://www.pushsafer.com/api?k=KEY&d=1422&i=9&v=3&m=Message
and that did work

User avatar
admin
Site Admin
Posts: 590
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: arduino pushsafer can't compile

Postby admin » 8. Jan 2017, 20:33

an pushsafer api request have to sent over a secure connection.
When you do a normal http request (without POST variable) the server make a redirect to a https connection.
But this do not seem to work while using a POST request.

So you have to use a third party library for https connection.

Or you do a GET request by appending all variables to the API URL like the URL generator do.
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 8. Jan 2017, 20:44

ok thanks

I will try the GET since I did make that work on a other project, I was talking to PHP file on my server and he was sending email.

it look like this

Code: Select all

client.println("GET /send_email.php?temperature="+temperature+"&humidity="+humidity+" HTTP/1.1"); //Send data
in our case we do something like this

Code: Select all

client.println("Host: http://www.pushsafer.com");
client.println("GET /api?k=key&d=1927&i=9&v=3&m=Message HTTP/1.1"); 
will play with that and let you know.
Also went I have time, will try the library for secure connection.

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 8. Jan 2017, 20:49

oh :o

I now have this message with the GET

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https:///">here</a>.</p>
<hr>
<address>Apache Server at www.pushsafer.com Port 80</address>
</body></html>
when I send to HTTPS

Code: Select all

    client.println("Host: https://www.pushsafer.com");
    client.println("GET /api?k=key&d=1927&i=9&v=3&m=Message HTTP/1.1"); 

I get this

Code: Select all

....................................Connected
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>Host: to /index.html not supported.<br />
</p>
<hr>
<address>Apache Server at default Port 80</address>
</body></html>

User avatar
admin
Site Admin
Posts: 590
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: arduino pushsafer can't compile

Postby admin » 8. Jan 2017, 20:53

This message over http

Code: Select all

301 Moved Permanently
is normal, because the redirecting from http to https

do you get a notification to your device?
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 8. Jan 2017, 21:01

admin wrote:do you get a notification to your device?
no, trust me, when I get notification, you will be the first to know :)

I am trying different ways using GET, I am not very familiar with web request, formating, etc.

User avatar
admin
Site Admin
Posts: 590
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: arduino pushsafer can't compile

Postby admin » 10. Jan 2017, 09:10

Hi robomaniac,

sorry for the late reply.

Now you can access the api via http or https.

Please take a try and give me a feedback!

Thanks Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 11. Jan 2017, 02:11

Hi Kevin,

My name is Jerome btw ;)

I got your message and I am trying hard to get this to work. I have tested lots of stuff so I will clean my code and try again.

Right now, I have this and lots of bad request.

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.pushsafer.com/data/push-send.php">here</a>.</p>
<hr>
<address>Apache Server at pushsafer.com Port 80</address>
</body></html>

I will focus using this instead, with this, I don't have other bad variable. does it make sense? Is there mistake?

Code: Select all

    client.print("Content-Length: ");
    client.print(length);
    client.println("\r\n");;
    client.print("k=insert_my_key");
    client.print("&m=message");
    client.print("&t=title");
    client.print("&s=2");
    client.print("&v=3");
    client.print("&i=3");
    client.print("&d=a");
    client.print("&retry=60");
    client.print("&expire=3600");



Tonight I will try other things and keep you updated. Thanks.

robomaniac

Re: arduino pushsafer can't compile

Postby robomaniac » 11. Jan 2017, 03:27

oh oh!

I just got message saying "below message limit, to expand your message capacity, go to your pushsafer dashboard..."

I was checking my last code and verifying

Code: Select all

https://www.pushsafer.com/api?k=insert_my_key&m=message&t=title&s=2&v=3&i=3&d=a&retry=60&expire=3600
with this

Code: Select all

    client.print("k=insert_my_key");
    client.print("&m=arduino");
    client.print("&t=enfin");
    client.print("&s=2");
    client.print("&v=3");
    client.print("&i=3");
    client.print("&d=a");
    client.print("&retry=60");
    client.print("&expire=3600");
to make sure I understand the creating of a link via GET


Who is online

Users browsing this forum: No registered users and 6 guests