Вот этот код
<?php
$apiKey = "key";
$url = "http://localhost:12345";
$post = [
"apikey" => $apiKey,
"task_type" => "file", // file, domain
"engines" => "avast,bitdef,nod32,fortinet,trend",
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$r = curl_exec($ch);
$error = curl_error($ch);
$info = curl_getinfo($ch);
curl_close($ch);
?>
Даёт вот это
[guest@localhost php]$ nc -l 12345
POST / HTTP/1.1
Host: localhost:12345
Accept: */*
Content-Length: 375
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------9d91faa43c374748
--------------------------9d91faa43c374748
Content-Disposition: form-data; name="apikey"
key
--------------------------9d91faa43c374748
Content-Disposition: form-data; name="task_type"
file
--------------------------9d91faa43c374748
Content-Disposition: form-data; name="engines"
avast,bitdef,nod32,fortinet,trend
--------------------------9d91faa43c374748--
[guest@localhost php]$
Вот этот код
#!/usr/bin/env python3
import requests
url = 'http://localhost:12345'
api_key = 'key'
data = {
'apikey': api_key,
'task_type': 'file', # file, domain
'engines': 'avast,bitdef,nod32,fortinet,trend'
}
requests.post(url, data=data)
Даёт вот это
[guest@localhost php]$ nc -l 12345
POST / HTTP/1.1
Host: localhost:12345
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 75
Content-Type: application/x-www-form-urlencoded
apikey=key&task_type=file&engines=avast%2Cbitdef%2Cnod32%2Cfortinet%2Ctrend
[guest@localhost php]$