Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:16 04 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : pushsafer

Author Message
venatici
Newbie

Joined: 09/02/2025
Location: Greece
Posts: 2
Posted: 07:29pm 01 Nov 2025
Copy link to clipboard 
Print this post

hello ,
I am trying to send a notification using pushsafer api without success .
I am using webmite on pico2 .
Have anyone done this before ?
Pushsafer requires an post method request with the message.
Thank you in advance.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4109
Posted: 11:01am 03 Nov 2025
Copy link to clipboard 
Print this post

Maybe post a short sample.

John
 
venatici
Newbie

Joined: 09/02/2025
Location: Greece
Posts: 2
Posted: 08:09pm 03 Nov 2025
Copy link to clipboard 
Print this post

here is my code
Option escape
' === Setup WiFi ===
Do While MM.Info(IP ADDRESS) = "0.0.0.0"
If Timer >5000 Then CPU RESTART
Loop
' === Set the API endpoint ===
url$ = "www.pushsafer.com/api"
port% = 80                          ' for HTTP; if HTTPS is supported youll need different handling
path$ = "/api"   ' the API path
eol$=Chr$(10)+Chr$(13)
' === Build the POST data ===
privateKey$ = "mysecretkey"
title$      = "Alert"
message$    = "notification"
dev$     = "a"   ' a means all devices or specify a device id/group

Dat$ = "k=" + privateKey$ + "&t=" + title$ +  "&m=" + message$ +   "&d=" + dev$


' === Build the HTTP request ===
req$="POST"+path$+ " HTTP/1.1"+eol$+"Host: " + url$+eol$
req$=req$+"Content-Type:application/x-www-form-urlencoded" +eol$
req$=req$+"Content-Length: "+Str$(Len(dat$))+eol$+"Connection:Keep-Alive"
req$=req$ +eol$ + Dat$+eol$

Print req$
Dim buff%(1000)
' === Open TCP connection ===
Print "--"

  WEB OPEN TCP CLIENT "www.pushsafer.com/api",80

WEB tcp client request req$,buff%()
LongString print buff%()

' === Close connection ===
WEB CLOSE tcp client
                     


i think the problem is in
web open tcp client "www.pushsafer.com/api"
the / return an error.
Edited 2025-11-04 06:09 by venatici
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025