| 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 |