http.Post
Example
Write a file in PHP, and invoke it from Lua. The output below is written in the file, not in the console.
<?php
$p = $_POST["p"];
$a = $_POST["a"];
$f = fopen("write.html", "w");
fwrite($f, "This is a test. $p $a\n");
fclose($f);
?>
http.Post( "http://localhost/post.php", { p = "Gmod", a = "Test" },
-- onSuccess function
function( body, length, headers, code )
print( "Done!" )
end,
-- onFailure function
function( message )
print( message )
end
)
Output:
This is a test. Gmod Test