download file with file_get_contents() php post data code example
Example 1: php get file contents
<?php
file_get_contents("file.txt");
?>
Example 2: php file get contents post
$postdata = http_build_query([
'var1' => 'some content',
'var2' => 'doh'
]);
$opts = [
'https' =>
[
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postdata
]
);
$result = file_get_contents('http://example.com/submit.php', false, stream_context_create($opts));