Splynx hooks issue php coding

Hi please see my post below when i work with variable they dont send the sms when an admin login but if i use the commented second option they receive the message

#!/usr/bin/php
<?php

$log_file = '/tmp/log_file.txt';

/* $message = "{$data['attributes']['name']}";
$to = "{$data['attributes']['phone']}";
$to = preg_replace('/\D/', '', $to); */
// please set
$smapisuser = "myapi";
$smsapipassword = "mypassword";

$to = "to admin number";
$message = "INTERBYSS: Se ha registrado un acceso administrador en el sistema";


$url = "https://rest.nexmo.com/sms/json?api_key={$smapisuser}&api_secret={$smsapipassword}&to={$to}&text={$message}&from=INTERBYSS"; -< this option not work

/*$url = "https://rest.nexmo.com/sms/json?api_key=myapi&api_secret=mypassword&to=mynumber&text=TEST&from=INTERBYSS";*/ -< this option work


$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => $url,
    CURLOPT_USERAGENT => 'CURL'
));
$resp = curl_exec($curl);
curl_close($curl);
//print $resp;