$post_data = ["file" => curl_file_create($file_name)];
<?php
$post_data = ["file" => curl_file_create($file_name)];
$this->_ch = curl_init();
curl_setopt($this->_ch, CURLOPT_URL, $url);
curl_setopt(
$this->_ch,
CURLOPT_USERAGENT,
'Mozilla/5.0'
);
curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($this->_ch, CURLOPT_COOKIEFILE, $this->_cookie);
curl_setopt($this->_ch, CURLOPT_COOKIEJAR, $this->_cookie);
curl_setopt($this->_ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($this->_ch, CURLOPT_POSTFIELDS, $post_data);
$result_ = curl_exec($this->_ch);
<pre><?php
echo "<b>SERVER</b>";
print_r($_SERVER);
echo '<hr>';
echo "<b>HEADERS</b>";
print_r(apache_request_headers());
echo '<hr>';
echo "<b>COOKIE</b>";
print_r($_COOKIE);
echo '<hr>';
echo "<b>REQUEST</b>";
print_r($_REQUEST);
?>
</pre>
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Server: nginx
Date: Sun, 16 Feb 2020 15:33:02 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 1666
Connection: keep-alive
Keep-Alive: timeout=60
Vary: Accept-Encoding
<pre><b>SERVER</b>Array
(
[HTTP_HOST] => example.net
[HTTP_X_FORWARDED_FOR] => 91.241.220.200
[HTTP_CONNECTION] => close
[CONTENT_LENGTH] => 85403
[HTTP_USER_AGENT] => Mozilla/5.0
[HTTP_ACCEPT] => */*
[HTTP_X_REQUESTED_WITH] => XMLHttpRequest
[CONTENT_TYPE] => multipart/form-data; boundary=------------------------644b415d544c9b32
[PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g
[SERVER_NAME] => example.net
[SERVER_ADDR] => 95.216.144.70
[SERVER_PORT] => 80
[REMOTE_ADDR] => 91.241.220.200
[DOCUMENT_ROOT] => /home/example/web/example.net/public_html
[REQUEST_SCHEME] => http
[CONTEXT_PREFIX] =>
[CONTEXT_DOCUMENT_ROOT] => /home/example/web/example.net/public_html
[SERVER_ADMIN] => info@example.net
[SCRIPT_FILENAME] => /home/example/web/example.net/public_html/ip.php
[REMOTE_PORT] => 58106
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.0
[REQUEST_METHOD] => PUT
[QUERY_STRING] =>
[REQUEST_URI] => /ip.php
[SCRIPT_NAME] => /ip.php
[PHP_SELF] => /ip.php
[REQUEST_TIME_FLOAT] => 1581867182.959
[REQUEST_TIME] => 1581867182
)
<hr><b>HEADERS</b>Array
(
[Host] => example.net
[X-Forwarded-For] => 91.241.220.200
[Connection] => close
[Content-Length] => 85403
[User-Agent] => Mozilla/5.0
[Accept] => */*
[X-Requested-With] => XMLHttpRequest
[Content-Type] => multipart/form-data; boundary=------------------------644b415d544c9b32
)
<hr><b>COOKIE</b>Array
(
)
<hr><b>REQUEST</b>Array
(
)
</pre>
Какие у меня там правила NAT я не знаю, обычный роутер TP link, в котором не менялись настройки за исключением проброса 80 порта.