Created
November 1, 2017 17:05
-
-
Save ericjames/dbf4feb0d65a5f4caef37c5eb2bb4c60 to your computer and use it in GitHub Desktop.
Writing a file on a server via URL POST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(-1); | |
header('Access-Control-Allow-Origin: *'); | |
$store = isset($_POST['store']) ? substr($_POST['store'],0,10) : false; | |
$fp = fopen('test.txt', 'r+'); | |
if ($store) { | |
fwrite($fp, $store); | |
} | |
$contents = fread($fp, 10000); | |
fclose($fp); | |
echo $contents; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment