<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"text": "hello there"
}',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Copy
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setBody('{
\n "text": "hello there"
\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Copy
<?php
$client = new Client();
$body = '{
"text": "hello there"
}';
$request = new Request('POST', 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX', [], $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Copy
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'dash.wasniper.com',
'path': '/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX',
'headers': {
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "{\r\n \"text\": \"hello there\"\r\n}";
req.write(postData);
req.end(); Copy
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX',
'headers': {
},
body: '{\r\n "text": "hello there"\r\n}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Copy
var unirest = require('unirest');
var req = unirest('POST', 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX')
.send("{\r\n \"text\": \"hello there\"\r\n}")
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
Copy
var axios = require('axios');
var data = '{\r\n "text": "hello there"\r\n}';
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX',
headers: { },
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Copy
var settings = {
"url": "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX",
"method": "POST",
"timeout": 0,
"data": "{\r\n \"text\": \"hello there\"\r\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
}); Copy
var raw = "{\r\n \"text\": \"hello there\"\r\n}";
var requestOptions = {
method: 'POST',
body: raw,
redirect: 'follow'
};
fetch("https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error)); Copy
// WARNING: For POST requests, body is set to null by browsers.
var data = "{\r\n \"text\": \"hello there\"\r\n}";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX");
xhr.send(data); Copy
import http.client
conn = http.client.HTTPSConnection("dash.wasniper.com")
payload = "{\r\n \"text\": \"hello there\"\r\n}"
headers = {}
conn.request("POST", "/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8")) Copy
import requests
url = "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX"
payload = "{\r\n \"text\": \"hello there\"\r\n}"
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Copy
curl --location -g 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX' \
--data '{
"text": "hello there"
}'
Copy
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"text\": \"hello there\"\r\n}");
Request request = new Request.Builder()
.url("https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX")
.method("POST", body)
.build();
Response response = client.newCall(request).execute(); Copy
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.post("https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX")
.body("{\r\n \"text\": \"hello there\"\r\n}")
.asString();
Copy
require "uri"
require "net/http"
url = URI("https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "{\r\n \"text\": \"hello there\"\r\n}"
response = https.request(request)
puts response.read_body
Copy
Imports System.Net
Imports System.Text
Module example
Sub Main()
Dim WebRequest As HttpWebRequest
WebRequest = HttpWebRequest.Create("https://api.wasniper.com/{INSTANCE_ID}/messages/chat")
Dim postdata As String = "token={TOKEN}&to=&body=&priority=&referenceId=&msgId=&mentions="
Dim enc As UTF8Encoding = New System.Text.UTF8Encoding()
Dim postdatabytes As Byte() = enc.GetBytes(postdata)
WebRequest.Method = "POST"
WebRequest.ContentType = "application/x-www-form-urlencoded"
WebRequest.GetRequestStream().Write(postdatabytes)
'WebRequest.GetRequestStream().Write(postdatabytes, 0, postdatabytes.Length)
Dim ret As New System.IO.StreamReader(WebRequest.GetResponse().GetResponseStream())
console.writeline(ret.ReadToEnd())
End Sub
End Module Copy
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX");
var content = new StringContent("{\r\n \"text\": \"hello there\"\r\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Copy
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"text": "hello there"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
} Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\r\n \"text\": \"hello there\"\r\n}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
Copy
var request = http.Request('POST', Uri.parse('https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX'));
request.body = '''{\r\n "text": "hello there"\r\n}''';
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
Copy
let parameters = "{\r\n \"text\": \"hello there\"\r\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX")!,timeoutInterval: Double.infinity)
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Copy
#import
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSData *postData = [[NSData alloc] initWithData:[@"{\r\n \"text\": \"hello there\"\r\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); Copy
$body = "{
`n `"text`": `"hello there`"
`n}"
$response = Invoke-RestMethod 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Copy
$body = "{
`n `"text`": `"hello there`"
`n}"
$response = Invoke-RestMethod 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json Copy
curl --request POST \
--url https://api.wasniper.com/{INSTANCE_ID}/messages/chat \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'token={TOKEN}' \
--data-urlencode 'to=' \
--data-urlencode 'body=' \
--data-urlencode 'priority=' \
--data-urlencode 'referenceId=' \
--data-urlencode 'msgId=' \
--data-urlencode 'mentions='
Copy
printf '{
"text": "hello there"
}'| http --follow --timeout 3600 POST 'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX'
Copy
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header '' \
--body-data '{
"text": "hello there"
}' \
'https://dash.wasniper.com/api/send.php?instance_id={{instance_id}}&access_token={{access_token}}&type=json&number=9190698XXXXX' Copy