<?php
$url = 'https://sender.x-sun.net/api/create-message';
$data = array(
'appkey' => '{Your_API_KEY}',
'authkey' => '{Your_AUTH_KEY}',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'sandbox' => 'false'
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
require_once 'HTTP/Request2.php';
$url = 'https://sender.x-sun.net/api/create-message';
$data = array(
'appkey' => '{Your_API_KEY}',
'authkey' => '{Your_AUTH_KEY}',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'sandbox' => 'false'
);
$request = new HTTP_Request2($url, HTTP_Request2::METHOD_POST);
$request->setHeader('Content-Type: application/x-www-form-urlencoded');
$request->addPostParameter($data);
try {
$response = $request->send();
echo $response->getBody();
} catch (HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
<?php
use GuzzleHttp\Client;
$url = 'https://sender.x-sun.net/api/create-message';
$data = [
'appkey' => '{Your_API_KEY}',
'authkey' => '{Your_AUTH_KEY}',
'to' => 'RECEIVER_NUMBER',
'message' => 'Example message',
'sandbox' => 'false',
];
$client = new Client();
$response = $client->post($url, [
'form_params' => $data,
]);
echo $response->getBody();
const http = require('http');
const querystring = require('querystring');
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
};
const req = http.request(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
});
req.on('error', (error) => {
console.error(error);
});
req.write(querystring.stringify(data));
req.end();
const request = require('request');
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
request.post({
url: url,
form: data,
}, function (error, response, body) {
if (error) {
console.error(error);
} else {
console.log(body);
}
});
const unirest = require('unirest');
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
unirest.post(url)
.headers({ 'Content-Type': 'application/x-www-form-urlencoded' })
.form(data)
.end(function (response) {
console.log(response.body);
});
const axios = require('axios');
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
axios.post(url, data)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
$.ajax({
url: url,
type: 'POST',
data: data,
success: function(response) {
console.log(response);
},
error: function(error) {
console.error(error);
}
});
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams(data),
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
const url = 'https://sender.x-sun.net/api/create-message';
const data = {
appkey: '{Your_API_KEY}',
authkey: '{Your_AUTH_KEY}',
to: 'RECEIVER_NUMBER',
message: 'Example message',
sandbox: 'false',
};
const xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
console.log(JSON.parse(xhr.responseText));
} else {
console.error(xhr.statusText);
}
};
xhr.onerror = function () {
console.error('Terjadi kesalahan jaringan');
};
xhr.send(new URLSearchParams(data));
import http.client
import json
url = '/api/create-message'
api_key = '{Your_API_KEY}'
auth_key = '{Your_AUTH_KEY}'
receiver_number = 'RECEIVER_NUMBER'
message = 'Example message'
sandbox = 'false'
data = f'appkey={api_key}&authkey={auth_key}&to={receiver_number}&message={message}&sandbox={sandbox}'
connection = http.client.HTTPSConnection('sender.x-sun.net')
headers = {'Content-type': 'application/x-www-form-urlencoded'}
connection.request('POST', url, body=data, headers=headers)
response = connection.getresponse()
if response.status == 200:
result = json.loads(response.read().decode('utf-8'))
print(result)
else:
print(f'Error: {response.status}, {response.reason}')
connection.close()
import requests
url = 'https://sender.x-sun.net/api/create-message'
api_key = '{Your_API_KEY}'
auth_key = '{Your_AUTH_KEY}'
receiver_number = 'RECEIVER_NUMBER'
message = 'Example message'
sandbox = 'false'
data = {
'appkey': api_key,
'authkey': auth_key,
'to': receiver_number,
'message': message,
'sandbox': sandbox,
}
response = requests.post(url, data=data)
if response.status_code == 200:
result = response.json()
print(result)
else:
print(f'Error: {response.status_code}, {response.reason}')
curl -X POST \
https://sender.x-sun.net/api/create-message \
-d 'appkey={Your_API_KEY}&authkey={Your_AUTH_KEY}&to=RECEIVER_NUMBER&message=Example%20message&sandbox=false'
import okhttp3.*;
public class SendMessage {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
String url = "https://sender.x-sun.net/api/create-message";
String apiKey = "{Your_API_KEY}";
String authKey = "{Your_AUTH_KEY}";
String receiverNumber = "RECEIVER_NUMBER";
String message = "Example message";
RequestBody requestBody = new FormBody.Builder()
.add("appkey", apiKey)
.add("authkey", authKey)
.add("to", receiverNumber)
.add("message", message)
.add("sandbox", "false")
.build();
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
try {
Response response = client.newCall(request).execute();
// Print the response body
System.out.println(response.body().string());
response.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
public class SendMessage {
public static void main(String[] args) {
String url = "https://sender.x-sun.net/api/create-message";
String apiKey = "{Your_API_KEY}";
String authKey = "{Your_AUTH_KEY}";
String receiverNumber = "RECEIVER_NUMBER";
String message = "Example message";
HttpResponse response = Unirest.post(url)
.field("appkey", apiKey)
.field("authkey", authKey)
.field("to", receiverNumber)
.field("message", message)
.field("sandbox", "false")
.asJson();
System.out.println(response.getBody());
}
}
require 'httparty'
url = 'https://sender.x-sun.net/api/create-message'
api_key = '{Your_API_KEY}'
auth_key = '{Your_AUTH_KEY}'
receiver_number = 'RECEIVER_NUMBER'
message = 'Example message'
response = HTTParty.post(url, body: {
appkey: api_key,
authkey: auth_key,
to: receiver_number,
message: message,
sandbox: 'false'
})
puts response.body
Imports System.Net.Http
Imports System.Text
Module Module1
Sub Main()
Dim apiKey As String = "{Your_API_KEY}"
Dim authKey As String = "{Your_AUTH_KEY}"
Dim receiverNumber As String = "RECEIVER_NUMBER"
Dim message As String = "Example message"
Dim url As String = "https://sender.x-sun.net/api/create-message"
Dim client As New HttpClient()
Dim data As New List(Of KeyValuePair(Of String, String)) From {
New KeyValuePair(Of String, String)("appkey", apiKey),
New KeyValuePair(Of String, String)("authkey", authKey),
New KeyValuePair(Of String, String)("to", receiverNumber),
New KeyValuePair(Of String, String)("message", message),
New KeyValuePair(Of String, String)("sandbox", "false")
}
Dim content As New FormUrlEncodedContent(data)
Dim response As HttpResponseMessage = client.PostAsync(url, content).Result
Dim responseContent As String = response.Content.ReadAsStringAsync().Result
Console.WriteLine(responseContent)
End Sub
End Module
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiKey = "{Your_API_KEY}";
string authKey = "{Your_AUTH_KEY}";
string receiverNumber = "RECEIVER_NUMBER";
string message = "Example message";
string url = "https://sender.x-sun.net/api/create-message";
using (HttpClient client = new HttpClient())
{
var data = new List>
{
new KeyValuePair("appkey", apiKey),
new KeyValuePair("authkey", authKey),
new KeyValuePair("to", receiverNumber),
new KeyValuePair("message", message),
new KeyValuePair("sandbox", "false")
};
var content = new FormUrlEncodedContent(data);
HttpResponseMessage response = await client.PostAsync(url, content);
string responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
}
}
}
package main
import (
"bytes"
"fmt"
"net/http"
"net/url"
)
func main() {
apiKey := "{Your_API_KEY}"
authKey := "{Your_AUTH_KEY}"
receiverNumber := "RECEIVER_NUMBER"
message := "Example message"
url := "https://sender.x-sun.net/api/create-message"
data := url.Values{}
data.Set("appkey", apiKey)
data.Set("authkey", authKey)
data.Set("to", receiverNumber)
data.Set("message", message)
data.Set("sandbox", "false")
resp, err := http.PostForm(url, data)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
buffer := new(bytes.Buffer)
buffer.ReadFrom(resp.Body)
responseBody := buffer.String()
fmt.Println(responseBody)
}
#include <stdio.h>
#include <curl/curl.h>
int main() {
const char *api_key = "{Your_API_KEY}";
const char *auth_key = "{Your_AUTH_KEY}";
const char *receiver_number = "RECEIVER_NUMBER";
const char *message = "Example message";
const char *url = "https://sender.x-sun.net/api/create-message";
CURL *curl = curl_easy_init();
if (!curl) {
fprintf(stderr, "Failed to initialize libcurl\n");
return 1;
}
struct curl_httppost *post = NULL;
struct curl_httppost *last = NULL;
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "appkey",
CURLFORM_COPYCONTENTS, api_key,
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "authkey",
CURLFORM_COPYCONTENTS, auth_key,
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "to",
CURLFORM_COPYCONTENTS, receiver_number,
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "message",
CURLFORM_COPYCONTENTS, message,
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "sandbox",
CURLFORM_COPYCONTENTS, "false",
CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, stdout);
CURLcode res = curl_easy_perform(curl);
curl_formfree(post);
curl_easy_cleanup(curl);
if (res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
return 1;
}
return 0;
}
(ns your-namespace
(:require [clj-http.client :as client]))
(defn send-message []
; Replace {Your_API_KEY}, {Your_AUTH_KEY}, and RECEIVER_NUMBER with your actual values
(let [api-key "{Your_API_KEY}"
auth-key "{Your_AUTH_KEY}"
receiver-number "RECEIVER_NUMBER"
message "Example message"
sandbox "false"
url "https://sender.x-sun.net/api/create-message"
data {:form-params {"appkey" api-key
"authkey" auth-key
"to" receiver-number
"message" message
"sandbox" sandbox}}]
; Perform the POST request
(try
(let [response (client/post url data)]
; Print the response body
(println (:body response)))
(catch Exception e
(println "Error:" e)))))
import 'package:http/http.dart' as http;
void main() async {
String apiKey = "{Your_API_KEY}";
String authKey = "{Your_AUTH_KEY}";
String receiverNumber = "RECEIVER_NUMBER";
String message = "Example message";
String sandbox = "false";
Uri url = Uri.parse("https://sender.x-sun.net/api/create-message");
Map data = {
'appkey': apiKey,
'authkey': authKey,
'to': receiverNumber,
'message': message,
'sandbox': sandbox,
};
try {
var response = await http.post(url, body: data);
print(response.body);
} catch (error) {
print("Error: $error");
}
}
import Foundation
let apiKey = "{Your_API_KEY}"
let authKey = "{Your_AUTH_KEY}"
let receiverNumber = "RECEIVER_NUMBER"
let message = "Example message"
let sandbox = "false"
let urlString = "https://sender.x-sun.net/api/create-message"
let url = URL(string: urlString)!
var request = URLRequest(url: url)
request.httpMethod = "POST"
let bodyData = "appkey=\(apiKey)&authkey=\(authKey)&to=\(receiverNumber)&message=\(message)&sandbox=\(sandbox)"
request.httpBody = bodyData.data(using: .utf8)
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print("Error: \(error)")
} else if let data = data {
if let responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
}
task.resume()
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *apiKey = @"{Your_API_KEY}";
NSString *authKey = @"{Your_AUTH_KEY}";
NSString *receiverNumber = @"RECEIVER_NUMBER";
NSString *message = @"Example message";
NSString *sandbox = @"false";
NSString *urlString = @"https://sender.x-sun.net/api/create-message";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
NSString *bodyData = [NSString stringWithFormat:@"appkey=%@&authkey=%@&to=%@&message=%@&sandbox=%@", apiKey, authKey, receiverNumber, message, sandbox];
request.HTTPBody = [bodyData dataUsingEncoding:NSUTF8StringEncoding];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (error) {
NSLog(@"Error: %@", error);
} else if (data) {
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", responseString);
}
}];
[task resume];
[[NSRunLoop currentRunLoop] run];
}
return 0;
}
$apiKey = "{Your_API_KEY}"
$authKey = "{Your_AUTH_KEY}"
$receiverNumber = "RECEIVER_NUMBER"
$message = "Example message"
$sandbox = "false"
$url = "https://sender.x-sun.net/api/create-message"
$headers = @{
"Content-Type" = "application/x-www-form-urlencoded"
}
$body = @{
appkey = $apiKey
authkey = $authKey
to = $receiverNumber
message = $message
sandbox = $sandbox
}
$response = Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body $body
Write-Output $response.Content
$apiKey = "{Your_API_KEY}"
$authKey = "{Your_AUTH_KEY}"
$receiverNumber = "RECEIVER_NUMBER"
$message = "Example message"
$sandbox = "false"
$url = "https://sender.x-sun.net/api/create-message"
$body = @{
appkey = $apiKey
authkey = $authKey
to = $receiverNumber
message = $message
sandbox = $sandbox
}
$response = Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType "application/x-www-form-urlencoded"
Write-Output $response
#!/bin/bash
apiKey="{Your_API_KEY}"
authKey="{Your_AUTH_KEY}"
receiverNumber="RECEIVER_NUMBER"
message="Example message"
sandbox="false"
url="https://sender.x-sun.net/api/create-message"
curl -X POST $url \
-d "appkey=$apiKey" \
-d "authkey=$authKey" \
-d "to=$receiverNumber" \
-d "message=$message" \
-d "sandbox=$sandbox"
#!/bin/bash
apiKey="{Your_API_KEY}"
authKey="{Your_AUTH_KEY}"
receiverNumber="RECEIVER_NUMBER"
message="Example message"
sandbox="false"
url="https://sender.x-sun.net/api/create-message"
http POST $url \
appkey=$apiKey \
authkey=$authKey \
to=$receiverNumber \
message=$message \
sandbox=$sandbox
#!/bin/bash
apiKey="{Your_API_KEY}"
authKey="{Your_AUTH_KEY}"
receiverNumber="RECEIVER_NUMBER"
message="Example message"
sandbox="false"
url="https://sender.x-sun.net/api/create-message"
wget --post-data "appkey=$apiKey&authkey=$authKey&to=$receiverNumber&message=$message&sandbox=$sandbox" $url -O -