im trying to send a text using app inventor into my webserver which the php script read the text and then display it, do u have any insight about this?
Do you mean in webviewer?
i have setup my own localhost webserver and im trying to send a text message from my app to the server and then my php script would get and print it out, i tried asking chatgpt it gave me a php script like this
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $message = $_POST['message']; // Do something with $message here echo "Received message: " . $message; } else { echo "No message received"; } ?>which is located in my htdocs
- Create this file, named
outputText.php
in the web root of your server:
<?php
$varName=$_GET['varName'];
echo nl2br("The text sent from AppInventor is: \n\n" . $varName);
?>
- Set up your blocks in AppInventor like so:
- You should see this in your webviewer:
I do not get this with my local server on Linux Xubuntu calling the php file from an app.
Probably in your php settings somewhere, or your server requires additional php code - isset
A google returns this
Try this ?
<?php
$varName = '';
if (isset($varName)) {
$varName=$_GET['varName'];
echo nl2br("The text sent from AppInventor is: \n\n" . $varName);
}
?>