hi i am using Twilio Api to send sms to users, it gives fatal error if user's phone number is invalid. i want to validate the phone number before sending messages.
Currently i am using the following method to validate it:
public function get_web_page($url) {
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "test", // name of client
CURLOPT_AUTOREFERER => true, // set referrer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect
CURLOPT_TIMEOUT => 120, // time-out on response
);
$session = curl_init($url);
curl_setopt_array($session, $options);
$content = curl_exec($session);
curl_close($session);
return $content;
}
$response = $this->get_web_page("http://ift.tt/1PuENe3");
$resArr = array();
$resArr = json_decode($response)
and it works fine.
but i want to validate it using twilio's inbuilt functionality. I have searched alot on internet, but nothing helped.
Please help me to sort out this issue.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire