I want to be able to send a few variables to a file through file_get_contents().
This is firstfile.php:
The following code snippet shows an easy way how to send a HTTP post request using the PHP function file_get_contents:
'value1', 'param2' => 'value2')
// use key 'http' even if you send the request to https://...
$options = array('http' => array(
'method' => 'POST',
'content' => http_build_query($data)
));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
print_r($result);
OR Passing variable in a URL (php) & file_get_contents()