<?php
$params=array(
'to' => '',
'body' => ''
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.alvochat.com/instance1/messages/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Copy
<?php
require_once 'HTTP/Request2.php';
$params=array(
'to' => '',
'body' => ''
);
$request = new HTTP_Request2();
$request->setUrl('https://api.alvochat.com/instance1/messages/chat');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter($params);
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
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
$params=array(
'to' => '',
'body' => ''
);
$client = new Client();
$headers = [
'Content-Type' => 'application/x-www-form-urlencoded'
];
$options = ['form_params' =>$params ];
$request = new Request('POST', 'https://api.alvochat.com/instance1/messages/chat', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Copy
var qs = require("querystring");
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.alvochat.com",
"port": null,
"path": "/instance1/messages/chat",
"headers": {
"content-type": "application/x-www-form-urlencoded"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
var postData = qs.stringify({
"to": "",
"body": ""
});
req.write(postData);
req.end();
Copy
var request = require("request");
var options = {
method: 'POST',
url: 'https://api.alvochat.com/instance1/messages/chat',
headers: {'content-type': ' application/x-www-form-urlencoded'},
form: {
"to": "",
"body": ""
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Copy
var unirest = require("unirest");
var req = unirest("POST", "https://api.alvochat.com/instance1/messages/chat");
req.headers({
"content-type": "application/x-www-form-urlencoded"
});
req.form({
"to": "",
"body": ""
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
Copy
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
"to": "",
"body": ""
});
var config = {
method: 'post',
url: 'https://api.alvochat.com/instance1/messages/chat',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Copy
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.alvochat.com/instance1/messages/chat",
"method": "POST",
"headers": {},
"data": {
"to": "",
"body": ""
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Copy
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("to","");
urlencoded.append("body","");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api.alvochat.com/instance1/messages/chat", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Copy
var data = "to=&body=";
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.alvochat.com/instance1/messages/chat");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
Copy
import http.client
import ssl
conn = http.client.HTTPSConnection("api.alvochat.com",context = ssl._create_unverified_context())
payload = "to=&body="
payload = payload.encode('utf8').decode('iso-8859-1')
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/instance1/messages/chat", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Copy
import requests
url = "https://api.alvochat.com/instance1/messages/chat"
payload = "to=&body="
payload = payload.encode('utf8').decode('iso-8859-1')
headers = {'content-type': 'application/x-www-form-urlencoded'}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Copy
curl --request POST \
--url https://api.alvochat.com/instance1/messages/chat \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'to=' \
--data-urlencode 'body='
Copy
OkHttpClient client = new OkHttpClient();
RequestBody body = new FormBody.Builder()
.add("to", "")
.add("body", "")
.build();
Request request = new Request.Builder()
.url("https://api.alvochat.com/instance1/messages/chat")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.alvochat.com/instance1/messages/chat")
.header("Content-Type", "application/x-www-form-urlencoded")
.field("to", "")
.field("body", "")
.asString();
System.out.println(response.getBody());
Copy
require 'uri'
require 'net/http'
url = URI("https://api.alvochat.com/instance1/messages/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
form_data = URI.encode_www_form( {
:to => '',
:body => ''
})
request.body = form_data
response = http.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.alvochat.com/instance1/messages/chat")
Dim postdata As String = "to=&body="
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
using System;
using System.Threading.Tasks;
using RestSharp;
public class Program
{
public static async Task Main()
{
var url = "https://api.alvochat.com/instance1/messages/chat";
var client = new RestClient(url);
var request = new RestRequest(url, Method.Post);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("to", "");
request.AddParameter("body", "");
RestResponse response = await client.ExecuteAsync(request);
var output = response.Content;
Console.WriteLine(output);
}
}
Copy
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"net/url"
)
func main() {
apiurl:= "https://api.alvochat.com/instance1/messages/chat"
data := url.Values{}
data.Set("to", "")
data.Set("body", "")
payload := strings.NewReader(data.Encode())
req, _ := http.NewRequest("POST", apiurl, payload)
req.Header.Add("content-type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
Copy
#include <curl/curl.h>
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.alvochat.com/instance1/messages/chat");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "to=&body=");
CURLcode ret = curl_easy_perform(hnd);
Copy
(require '[clj-http.client :as client])
(client/post "https://api.alvochat.com/instance1/messages/chat" {:headers {:content-type "application/x-www-form-urlencoded"}:form-params {
:to ""
:body ""
}
})
Copy
import 'package:http/http.dart' as http;
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
};
var request = http.Request('POST', Uri.parse('https://api.alvochat.com/instance1/messages/chat'));
request.bodyFields = '{
'to':'',
'body':''
}';
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
Copy
import Foundation
import Cocoa
let postData = NSMutableData(data: "send=true".data(using: String.Encoding.utf8)!)
postData.append("&to=".data(using: String.Encoding.utf8)!)
postData.append("&body=".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://api.alvochat.com/instance1/messages/chat")! as URL,cachePolicy: .useProtocolCachePolicy,timeoutInterval: 10.0)
request.httpMethod = "POST"
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Copy
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.alvochat.com/instance1/messages/chat"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/x-www-form-urlencoded"
};
[request setAllHTTPHeaderFields:headers];
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"send=true" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&to=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&body=" 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
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.alvochat.com/instance1/messages/chat' -Method POST -Headers $headers -Body 'to=&body='
Copy
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri 'https://api.alvochat.com/instance1/messages/chat' -Method POST -Headers $headers -Body 'to=&body='
Copy
curl --request POST \
--url https://api.alvochat.com/instance1/messages/chat \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'to=' \
--data-urlencode 'body='
Copy
http --form POST https://api.alvochat.com/instance1/messages/chat \
content-type:application/x-www-form-urlencoded \
to='' \
body=''
Copy
wget --quiet \
--method POST \
--header 'content-type:application/x-www-form-urlencoded' \
--body-data 'to=&body=' \
--output-document \
- https://api.alvochat.com/instance1/messages/chat
Copy