I'm trying to post some data to a site, and if there is data it'll echo "posted", if not it'll echo "not posted". However, when using this, I try to post data to the site and it always does "not posted".
Here's my php code: if (!empty($_POST)){ echo'posted' } else { echo'not posted'}
Here's my lua code: print(game:GetService("HttpService"):PostAsync("http://local??host/tutorial/index.??php","test"))
Thanks so much!
AFAIK, the $_POST
variable in PHP is only used for form encoded post values (i.e., a format used by HTML forms, and not by your code here)
Use $postdata = file_get_contents("php://input");
to get the full contents of the posted message.