php get file contents
snippet in php

php get file contents

user1485

<?php
file_get_contents("file.txt");
?>

php file get contents post

user8999

$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));

transfer file using file_get_content

user9171

$header = 'Content-Type: multipart/form-data; boundary='.MULTIPART_BOUNDARY;