通过sendgrid通过azure web app发送电子邮件

I have a website running on azure and I am able to receive emails. I have Sendgrid account installed in my azure. But I have subscriber form, I need to send thank you email to subscribers. I am not able to figure out how to get form data into my php sendgrid file. Please help me out in getting form data into php.

My action_page.php file
    <?php

$url = 'https://api.sendgrid.com/';
$user = 'username';
$pass = 'pwd'; 

$params = array(
    'api_user'  => $user,
    'api_key'   => $pass,
    'to'        => 'subscriber email',
    'subject'   => 'testing from curl',
    'html'      => 'testing body',
    'text'      => 'testing body',
    'from'      => 'company email',
  );


$request =  $url.'api/mail.send.json';

// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// obtain response
$response = curl_exec($session);
curl_close($session);

// print everything out
print_r($response);

?>

HTML file

<form action="action_page.php" method="POST" >

  <input type="text" id="fname" name="firstname" placeholder="First Name">

  <br>

  <input type="text" id="lname" name="lastname" placeholder="Last Name">

  <br>

  <input type="email" id="email" name="email" placeholder="Email">

  <br>

  <label>

  <input type="checkbox" checked="checked" name="remember" value="Yes" style="margin-bottom:15px">

  <span style="color:#f08615"> Sign up for latest news</span>

    </label>

    <br>



<input type="submit" name="subscribe" value="Subscribe">

</form>