Last active
November 21, 2021 10:22
-
-
Save tsudot/41eae953c6af09131157 to your computer and use it in GitHub Desktop.
Send an SMS using curl through Plivo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Plivo AUTH ID | |
$AUTH_ID = ''; | |
# Plivo AUTH TOKEN | |
$AUTH_TOKEN = ''; | |
# SMS sender ID. | |
$src = ''; | |
# SMS destination number | |
$dst = ''; | |
# SMS text | |
$text = ''; | |
$url = 'https://api.plivo.com/v1/Account/'.$AUTH_ID.'/Message/'; | |
$data = array("src" => "$src", "dst" => "$dst", "text" => "$text"); | |
$data_string = json_encode($data); | |
$ch=curl_init($url); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | |
curl_setopt($ch, CURLOPT_HEADER, true); | |
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); | |
curl_setopt($ch, CURLOPT_USERPWD, $AUTH_ID . ":" . $AUTH_TOKEN); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); | |
$response = curl_exec( $ch ); | |
curl_close($ch); | |
?> |
How to get call details how to pass this url in curl using get method, i have auth id
GET https://api.plivo.com/v1/Account/{auth_id}/Call/
Hi ,
I m trying to send sms to the India number from US Number . But it showing
"error": "Destination Phone Numbers need to be verified. Please go to https://manage.plivo.com/sandbox-numbers/ to verify them."
Is it necessary to buy India Number or any process is there.Can you help me it please.
@tsudot do you know how to do this with the SimpleTexting API?
I needed to add this to make it work:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
not working for me.. No response from the API request.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much!