[Nodogsplash] Nodogsplash Error 503, PHP content

PV Subramanian pvsub0 at gmail.com
Tue Mar 20 16:47:23 UTC 2018


Hello:

I am using Nodogsplash on a Raspberry Pi 3. The captive portal is a form
that takes a phone number and a message, and the form action calls a PHP
file, which sends the message to the phone number using Twilio (which turns
it into an SMS).

The setup has been tested on a PC, works fine.

When moved to the htdocs folder, I get an Internal Server Error 503.

Thank you for guidance

---HTML file start---
<html>
<body>

<form action="form_to_sms.php" method="post">
Phone: <input type="text" name="phone"><br>
Mesage: <input type="text" name="body"><br>
<input type="submit">
</form>

</body>
</html>
---HTML file end---

---PHP file start---
<html>
<body>

<p>Sending ...</p>

<?php

// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';

// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;

// Credentials to connect to Twilio
$sid = 'AC1234xxx';
$token = '8a18ccxxx';

// Twilio number the SMS message will be from. You can only send SMS
messages from a number purchased from Twilio.
$from = '+12223334444;

// Create a connection to Twilio's API with credentials
$client = new Client($sid, $token);

// Actually send the number. This is where the magic happens!
if(!empty($_POST['phone']) && !empty($_POST['body'])){

// Use the client to do fun stuff like send text messages!
$client->messages->create(
    // the number you'd like to send the message to
    $_POST['phone'],
    array(
        // A Twilio phone number you purchased at twilio.com/console
        'from' => $from,
        // the body of the text message you'd like to send
        'body' => $_POST['body']
    )
);
}
echo "Message sent, press Back button"
?>
</body>
</html>
---PHP file end---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ml.ninux.org/pipermail/nodogsplash/attachments/20180320/2a474b8e/attachment.htm>


More information about the Nodogsplash mailing list