Answer the question
In order to leave comments, you need to log in
How to send tcp/xml request to IP from under PHP?
There is an information system. From it in real time it is necessary to get images that go there "it is not known how". The documentation says: connect to port 14074, send tcp / xml requests required: authorization, subscription parameters, and in real time it will give data. The parameters are passed in the form (protocol version is the first thing to be sent to start communication) in response, the server will send . If you connect to PuTTy with the RAW type and send this phrase, then everything works out. In php I try to connect via<proto ver="1.0"/>
<proto ver="1.0">OK</proto>
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0)
$result = socket_connect($socket, $address, $port);
$msg = '<proto ver="1.0"/>';
$write=socket_write($socket, $msg, strlen($msg));
$fp = stream_socket_client("tcp://www.example.com:80", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}
Answer the question
In order to leave comments, you need to log in
if it is not forbidden in php.ini, you can do it easier
if the port is not standard, it is better to use curl
$curl = curl_init('http://nexusdigital.agency/API/....');
curl_setopt($curl, CURLOPT_PORT, 81);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 81);
$result = curl_exec($curl);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question