var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://RestApiMaster.toranjapp.ir/api/Values/Post");
request.Headers.Add("AppId", "api_key Password");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("", "<root><BrandName>DadehFa</BrandName><ReportKey>GetBarcodes</ReportKey></root>"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://RestApiMaster.toranjapp.ir/api/Values/Post',
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 => '=%3Croot%3E%3CBrandName%3EDadehFa%3C%2FBrandName%3E%3CReportKey%3EGetBarcodes%3C%2FReportKey%3E%3C%2Froot%3E',
CURLOPT_HTTPHEADER => array(
'AppId: api_key PassWord',
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://RestApiMaster.toranjapp.ir/api/Values/Post');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'AppId' => 'api_key PassWord',
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'' => '<root><BrandName>DadehFa</BrandName><ReportKey>GetBarcodes</ReportKey></root>'
));
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();
}
import requests
url = "https://RestApiMaster.toranjapp.ir/api/Values/Post"
payload = '=%3Croot%3E%3CBrandName%3EDadehFa%3C%2FBrandName%3E%3CReportKey%3EGetBarcodeByjnjnijuniujnujn%3C%2FReportKey%3E%3C%2Froot%3E'
headers = {
'AppId': 'api_key YourSecretPassword',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var https = require('follow-redirects').https;
var fs = require('fs');
var qs = require('querystring');
var options = {
'method': 'POST',
'hostname': 'https://RestApiMaster.toranjapp.ir',
'path': '/api/Values/Post',
'headers': {
'AppId': 'api_key YourSecretPassword',
'Content-Type': 'application/x-www-form-urlencoded'
},
'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 = qs.stringify({
'': '<root><BrandName>DadehFa</BrandName><ReportKey>GetBarcodeByjnjnijuniujnujn</ReportKey></root>'
});
req.write(postData);
req.end();