How to forward SMS messages to another phone number
When SMS messages are delivered to your Twilio phone number, Twilio will respond based on the application you have configured to that number. These messages are saved in your Twilio SMS logs in the Console, or click here for old Account Portal logs.
If you want to build SMS forwarding functionality from scratch and host it on your own server, you may also use the following code.
<?php header('Content-Type: text/html'); ?> <Response> <Message to="<?=$_REQUEST['PhoneNumber']?>"> <?=htmlspecialchars(substr($_REQUEST['From'] . ": " . $_REQUEST['Body'], 0, 1600))?> </Message> </Response>
If you save this code to your server as http://example.com/sms_forward.php, then you would configure your Twilio phone number with an SMS request URL like this:
Make sure you place the phone number you want to forward SMS messages to in the PhoneNumber parameter of the URL-encoding.