from urllib import request, parse
data = parse.urlencode({'key': 'HuxgBB', 'title': 'title', 'msg': 'message', 'event': 'event'}).encode()
req = request.Request("https://api.simplepush.io/send", data=data)
request.urlopen(req)
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.util.HashMap;
public class SimplepushHttpClientPost {
public static void main(String[] args) throws IOException, InterruptedException {
var values = new HashMap<String, String>() {{
put("key", "HuxgBB");
put("title", "title");
put("msg", "message");
put("event", "event");
}};
var objectMapper = new ObjectMapper();
String requestBody = objectMapper
.writeValueAsString(values);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.simplepush.io/send"))
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
}
}
const querystring = require('querystring');
const request = require('request');
const url = 'https://api.simplepush.io/send';
let data = { 'key': 'HuxgBB', 'title': 'title', 'msg': 'message', 'event': 'event' };
request.post({
url: url,
body: querystring.stringify(data),
}, function(error, response, body){
console.log(body);
});
package main
import (
"net/http"
"net/url"
"strings"
)
func main() {
apiUrl := "https://api.simplepush.io/send"
data := url.Values{}
data.Set("key", "HuxgBB")
data.Set("title", "title")
data.Set("msg", "message")
data.Set("event", "event")
u, _ := url.ParseRequestURI(apiUrl)
urlStr := u.String()
client := &http.Client{}
r, _ := http.NewRequest(http.MethodPost, urlStr, strings.NewReader(data.Encode()))
client.Do(r)
}
require 'net/http'
require 'uri'
uri = URI.parse("https://api.simplepush.io/send")
body = URI.encode_www_form({:key => 'HuxgBB', :title => 'title', :msg => 'message', :event => 'event'})
http = Net::HTTP.new(uri.host)
request = Net::HTTP::Post.new(uri.request_uri)
request.body = body
http.request(request)
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.simplepush.io/send",
[
"key" => "HuxgBB",
"title" => "title",
"msg" => "message",
"event" => "event"
]
);
$data = @{key='HuxgBB';title='title';msg='message';event='event'}
Invoke-WebRequest -uri 'https://api.simplepush.io/send' -Method POST -Body $data
curl --data 'key=HuxgBB&title=title&msg=message&event=event' https://api.simplepush.io/send