Created
April 4, 2012 19:29
-
-
Save kwoods/2304940 to your computer and use it in GitHub Desktop.
Grouptexting Sample
This file contains hidden or 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 | |
$data = array( | |
'User' => 'user', | |
'Password' => 'pass', | |
'PhoneNumbers' => array('1234567890'), | |
'Subject' => 'subject', | |
'Message' => 'message' | |
); | |
$curl = curl_init('https://app.grouptexting.com/sending/messages?format=json'); | |
curl_setopt($curl, CURLOPT_POST, 1); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_VERBOSE,1); | |
// If you experience SSL issues, perhaps due to an outdated SSL cert | |
// on your own server, try uncommenting the line below | |
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
$json = curl_exec($curl); | |
curl_close($curl); | |
$response = json_decode($json); | |
echo 'Status: ' . $response->Response->Status . "\n" . | |
'Subject: ' . $response->Response->Entry->Subject . "\n" . | |
'Message: ' . $response->Response->Entry->Message . "\n" . | |
'Total Recipients: ' . $response->Response->Entry->RecipientsCount . "\n" . | |
'Credits Charged: ' . $response->Response->Entry->Credits . "\n" . | |
'Phone Numbers: ' . implode(', ' , $response->Response->Entry->PhoneNumbers) . "\n" . | |
'Locally Opted Out Numbers: ' . implode(', ' , $response->Response->Entry->LocalOptOuts) . "\n" . | |
'Globally Opted Out Numbers: ' . implode(', ' , $response->Response->Entry->GlobalOptOuts) . "\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment