-1

How can I insert static phrases before and after $_POST variables? Here's the code that I'm using:

<?php
require_once '/home/example/public_html/sms/vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "MAM2IXMDVLNZI3xxxxxx";
$auth_token = "YmI0NmQyZWQ5MDcwNjEyNjc4ZTMxYjNhMmxxxxxx";

$p = new RestAPI($auth_id, $auth_token);

// Send a message
$params = array(
        'src' => 'AcmeLLC', // Sender's phone number with country code
        'dst' =>  $_POST["dst"], //Receiver's phone number with country code
        'text' => $_POST["text"], // Your SMS text message
        //'url' => 'http://example.com/sms.html', // The URL to which with the status of the message is sent
        'method' => 'POST' // The method used to call the url
    );
 // Send message
$response = $p->send_message($params);

// Print the response
echo "Response : ";
print_r ($response['response']);

// Print the Api ID
echo "<br> Api ID : {$response['response']['api_id']} <br>";

// Print the Message UUID
echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";

?>

I wish to achieve something like this:

'text' => Hello, $_POST["name"] Thank you for registering. Your unique membership ID is $_POST["memid"] More details have been sent on $_POST["email"]

As you know this is obviously wrong since there are no hints to suggest whether some word are actually static and other are received from Gravity Forms via POST. How should I go about this?

Thanks!

HDR
  • 76
  • 1
  • 8

1 Answers1

1

Here you go:

'text' => 'Hello'.$_POST["name"].'Thank you for registering. Your unique membership ID is'. $_POST["memid"] .'More details have been sent on'. $_POST["email"]

Enclose the text in single quotes.

Let me know if it works out.

Fakhruddin Ujjainwala
  • 2,493
  • 17
  • 26