Correct CURL syntax
Correct CURL syntax
Hi there! I need to activate specific push-notifications via CURL. I've been tried different syntax but no succeed. If I paste pushsafer generated link in browser everything works fine, but trying to do same via CURL gives no effect. What syntax should I use in CURL to succed?
Re: Correct CURL syntax
Hi,
here you will find some examples incl. CURL from PHP or Command Line.
https://www.pushsafer.com/en/pushapi
What programming language you use?
Kevin
here you will find some examples incl. CURL from PHP or Command Line.
https://www.pushsafer.com/en/pushapi
What programming language you use?
Kevin
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Re: Correct CURL syntax
Hi Kevin!
I'am using .bat file in Win10. Some event activate .bat file via cmd.exe. This .bat contains Pushsafer-generated link. When I paste this link manually in browser, it works. But when I try to activate it via .bat nothing happens. I guess there is some kind of issues with UTF-8 charset probably. There is code I using in .bat:
I'am using .bat file in Win10. Some event activate .bat file via cmd.exe. This .bat contains Pushsafer-generated link. When I paste this link manually in browser, it works. But when I try to activate it via .bat nothing happens. I guess there is some kind of issues with UTF-8 charset probably. There is code I using in .bat:
Code: Select all
curl --header "Content-Type: text/plain" --request PUT --data "OFF" https://[pushsafer_generated_URL]
exit
Re: Correct CURL syntax
Hi,
set the url in quotes, then it works
Kevin
set the url in quotes, then it works
Code: Select all
curl --header "Content-Type: text/plain" --request PUT --data "OFF" "https://www.pushsafer.com/api?k=XXXXXXXXXXXXXXXXXXXX&d=XXX&i=10&c=%23ffd699&v=3&pr=2&a=1&t=test&m=test"
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Re: Correct CURL syntax
Thanks Kevin!
So damn simple:) It works, but there is another problem. When I send push notification this way in latinic characters, it comes with 0 instead of spaces, for example "Motion0in0garage!". And when I try to send notification with cyrillic characters I receive sometging like this "BBE9FBEB4DBA19...". Is there any way to solve it? I really need to send cyrillic pushes
So damn simple:) It works, but there is another problem. When I send push notification this way in latinic characters, it comes with 0 instead of spaces, for example "Motion0in0garage!". And when I try to send notification with cyrillic characters I receive sometging like this "BBE9FBEB4DBA19...". Is there any way to solve it? I really need to send cyrillic pushes
Re: Correct CURL syntax
great that it works now.
You have to encode these characters
For static sending, you can use our url encoder:
https://www.pushsafer.com/en/url-encoder-decoder
Otherwise you can use this:
You have to encode these characters
For static sending, you can use our url encoder:
https://www.pushsafer.com/en/url-encoder-decoder
Otherwise you can use this:
Code: Select all
chcp 1252>nul
curl --header "Content-Type: text/plain" --request PUT --data "OFF" "https://www.pushsafer.com/api?k=XXXXXXXXXXXXXXXXXXX&d=XXX&i=10&c=%23ffd699&v=3&pr=2&a=1&t=test&m=АБВГДЕЖ"
chcp %cp%>nul
exit
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Re: Correct CURL syntax
Still doesn't work and I can't understand what I'am doing wrong:(
Well, when I encode cyrillic characters separately with your encode/decode tool, and paste encoded result to the link, I get API response {"status":0,"error":"invalid key or empty message"}
And when I using your CURL example, where I insert nonencoded cyrillic characters, it coming to phone with "9BBEBBEBBBE" again.
Let me explain my case: my soft in different situations can trigger different Windows batch files with Pushsafer pre-generated links, custom for each situation. Email triggers is kinda slow and can't show cyrillic characners too. May be I can use different CURL construction/syntax or command? Batch file is preferred for me, but also I can use vbs scripts instead of bat.
Well, when I encode cyrillic characters separately with your encode/decode tool, and paste encoded result to the link, I get API response {"status":0,"error":"invalid key or empty message"}
And when I using your CURL example, where I insert nonencoded cyrillic characters, it coming to phone with "9BBEBBEBBBE" again.
Let me explain my case: my soft in different situations can trigger different Windows batch files with Pushsafer pre-generated links, custom for each situation. Email triggers is kinda slow and can't show cyrillic characners too. May be I can use different CURL construction/syntax or command? Batch file is preferred for me, but also I can use vbs scripts instead of bat.
Re: Correct CURL syntax
can you send me your bat file by mail! I will check
Kevin
Kevin
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Who is online
Users browsing this forum: No registered users and 2 guests