TellMyCell Mass Text Message Marketing

PHP Code Samples For The REST API

The Developer Center @ TellMyCell

Code Samples

Sending SMS Messages

Sends SMS text messages via the short code 88202 to a single phone number or an array of phone numbers.
PHP - XML
<?php

$data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'PhoneNumbers'  => array('2123456785', '2123456786', '2123456787', '2123456788'),
    'Subject'       => 'From Winnie',
    'Message'       => 'I am a Bear of Very Little Brain, and long words bother me',
    'StampToSend'   => '1305582245'
);
 
$curl = curl_init('https://app.tellmycell.com/sending/messages?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);
 
$xml = new SimpleXMLElement($response);
 
foreach( $xml->Entry->PhoneNumbers->children() as $phoneNumber ) {
    $phoneNumbers[] = (string) $phoneNumber;
}
foreach( $xml->Entry->LocalOptOuts->children() as $phoneNumber ) {
    $localOptOuts[] = (string) $phoneNumber;
}
foreach( $xml->Entry->GlobalOptOuts->children() as $phoneNumber ) {
    $globalOptOuts[] = (string) $phoneNumber;
}
 
echo 'Status: ' . $xml->Status . "\n" .
     'Subject: ' . $xml->Entry->Subject . "\n" .
     'Message: ' . $xml->Entry->Message . "\n" .
     'Total Recipients: ' . $xml->Entry->RecipientsCount . "\n" .
     'Credits Charged: ' . $xml->Entry->Credits . "\n" .
     'Time To Send: ' . $xml->Entry->StampToSend . "\n" .
     'Phone Numbers: ' . implode(', ' , $phoneNumbers) . "\n" .
     'Locally Opted Out Numbers: ' . implode(', ' , $localOptOuts) . "\n" .
     'Globally Opted Out Numbers: ' . implode(', ' , $globalOptOuts) . "\n";
 
?>
                      
PHP - JSON
    <?php
    
    $data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'PhoneNumbers'  => array('2123456785', '2123456786', '2123456787', '2123456788'),
    'Subject'       => 'From Winnie',
    'Message'       => 'I am a Bear of Very Little Brain, and long words bother me',
    'StampToSend'   => '1305582245'
    );
    
    $curl = curl_init('https://app.tellmycell.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);
    // 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" .
    'Time To Send: ' . $response->Response->Entry->StampToSend . "\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";
    
    ?>
                      




Check Keyword Availability

Check whether a Keyword is available to rent on TellMyCell's short code.
PHP - XML
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh',
    'Keyword'  => 'honey'
);

$curl = curl_init('https://app.tellmycell.com/keywords/new?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
echo 'Status: ' . $xml->Status . "\n" .
     'Keyword: ' . $xml->Entry->Keyword . "\n" .
     'Availability: ' . $xml->Entry->Available . "\n";

?>              
PHP - JSON
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh',
    'Keyword'  => 'honey'
);

$curl = curl_init('https://app.tellmycell.com/keywords/new?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
echo 'Status: ' . $json->Response->Status . "\n" .
     'Keyword: ' . $json->Response->Entry->Keyword . "\n" .
     'Availability: ' . (int) $json->Response->Entry->Available . "\n";

?>              




Rent Keyword

Rents a Keyword for use on TellMyCell's short code. You may rent a Keyword using a credit card you have stored in your TellMyCell account, or you may pass credit card details when you call the API.
Stored Credit Card
PHP - XML
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'Keyword'          => 'honey',
    'StoredCreditCard' => '1111'
);

$curl = curl_init('https://app.tellmycell.com/keywords?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    foreach( $xml->Entry->ContactGroupIDs->children() as $group ) {
        $groups[] = (string) $group;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Keyword ID: ' . $xml->Entry->ID . "\n" .
         'Keyword: ' . $xml->Entry->Keyword . "\n" .
         'Is double opt-in enabled: ' . (int) $xml->Entry->EnableDoubleOptIn . "\n" .
         'Confirm message: ' . $xml->Entry->ConfirmMessage . "\n" .
         'Join message: ' . $xml->Entry->JoinMessage . "\n" .
         'Forward email: ' . $xml->Entry->ForwardEmail . "\n" .
         'Forward url: ' . $xml->Entry->ForwardUrl . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n";
}

?>
                      
Stored Credit Card
PHP - JSON
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'Keyword'          => 'honey',
    'StoredCreditCard' => '1111'
);

$curl = curl_init('https://app.tellmycell.com/keywords?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Keyword ID: ' . $json->Entry->ID . "\n" .
         'Keyword: ' . $json->Entry->Keyword . "\n" .
         'Is double opt-in enabled: ' . (int) $json->Entry->EnableDoubleOptIn . "\n" .
         'Confirm message: ' . $json->Entry->ConfirmMessage . "\n" .
         'Join message: ' . $json->Entry->JoinMessage . "\n" .
         'Forward email: ' . $json->Entry->ForwardEmail . "\n" .
         'Forward url: ' . $json->Entry->ForwardUrl . "\n" .
         'Groups: ' . implode(', ' , $json->Entry->ContactGroupIDs) . "\n";
}

?>

                      
Non-Stored Credit Card
PHP - XML
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'Keyword'          => 'honey',
    'FirstName'        => 'Winnie',
    'LastName'         => 'The Pooh',
    'Street'           => 'Hollow tree, under the name of Mr. Sanders',
    'City'             => 'Hundred Acre Woods',
    'State'            => 'New York',
    'Zip'              => '12345',
    'Country'          => 'US',
    'CreditCardTypeID' => 'Visa',
    'Number'           => '4111111111111111',
    'SecurityCode'     => '123',
    'ExpirationMonth'  => '10',
    'ExpirationYear'   => '2017'
);

$curl = curl_init('https://app.tellmycell.com/keywords?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
echo 'Status: ' . $xml->Status . "\n" .
     'Keyword ID: ' . $xml->Entry->ID . "\n" .
     'Keyword: ' . $xml->Entry->Keyword . "\n" .
     'Is double opt-in enabled: ' . (int) $xml->Entry->EnableDoubleOptIn . "\n" .
     'Confirm message: ' . $xml->Entry->ConfirmMessage . "\n" .
     'Join message: ' . $xml->Entry->JoinMessage . "\n" .
     'Forward email: ' . $xml->Entry->ForwardEmail . "\n" .
     'Forward url: ' . $xml->Entry->ForwardUrl . "\n" .
     'Groups: ' . implode(', ' , $xml->Entry->ContactGroupIDs) . "\n";

?>
                      
Non-Stored Credit Card
PHP - JSON
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'Keyword'          => 'honey',
    'FirstName'        => 'Winnie',
    'LastName'         => 'The Pooh',
    'Street'           => 'Hollow tree, under the name of Mr. Sanders',
    'City'             => 'Hundred Acre Woods',
    'State'            => 'New York',
    'Zip'              => '12345',
    'Country'          => 'US',
    'CreditCardTypeID' => 'Visa',
    'Number'           => '4111111111111111',
    'SecurityCode'     => '123',
    'ExpirationMonth'  => '10',
    'ExpirationYear'   => '2017'
);

$curl = curl_init('https://app.tellmycell.com/keywords?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
echo 'Status: ' . $json->Response->Status . "\n" .
     'Keyword ID: ' . $json->Response->Entry->ID . "\n" .
     'Keyword: ' . $json->Response->Entry->Keyword . "\n" .
     'Is double opt-in enabled: ' . (int) $json->Response->Entry->EnableDoubleOptIn . "\n" .
     'Confirm message: ' . $json->Response->Entry->ConfirmMessage . "\n" .
     'Join message: ' . $json->Response->Entry->JoinMessage . "\n" .
     'Forward email: ' . $json->Response->Entry->ForwardEmail . "\n" .
     'Forward url: ' . $json->Response->Entry->ForwardUrl . "\n" .
     'Groups: ' . implode(', ' , $json->Response->Entry->ContactGroupIDs) . "\n";

?>
                      




Setup A Keyword

Configures an active Keyword for use on TellMyCell's short code.
PHP - XML
<?php

$data = array(
    'User'              => 'winnie',
    'Password'          => 'the-pooh',
    'EnableDoubleOptIn' => true,
    'ConfirmMessage'    => 'Reply Y to join our sweetest list',
    'JoinMessage'       => 'The only reason for being a bee that I know of, is to make honey. And the only reason for making honey, is so as I can eat it.',
    'ForwardEmail'      => 'honey@bear-alliance.co.uk',
    'ForwardUrl'        => 'http://bear-alliance.co.uk/honey-donations/',
    'ContactGroupIDs'   => array('honey lovers')
);

$curl = curl_init('https://app.tellmycell.com/keywords/honey?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
foreach( $xml->Entry->ContactGroupIDs->children() as $group ) {
    $groups[] = (string) $group;
}

echo 'Status: ' . $xml->Status . "\n" .
     'Keyword ID: ' . $xml->Entry->ID . "\n" .
     'Keyword: ' . $xml->Entry->Keyword . "\n" .
     'Is double opt-in enabled: ' . (int) $xml->Entry->EnableDoubleOptIn . "\n" .
     'Confirm message: ' . $xml->Entry->ConfirmMessage . "\n" .
     'Join message: ' . $xml->Entry->JoinMessage . "\n" .
     'Forward email: ' . $xml->Entry->ForwardEmail . "\n" .
     'Forward url: ' . $xml->Entry->ForwardUrl . "\n" .
     'Groups: ' . implode(', ' , $groups) . "\n";

?>
                      
PHP - JSON
<?php

$data = array(
    'User'              => 'winnie',
    'Password'          => 'the-pooh',
    'EnableDoubleOptIn' => true,
    'ConfirmMessage'    => 'Reply Y to join our sweetest list',
    'JoinMessage'       => 'The only reason for being a bee that I know of, is to make honey. And the only reason for making honey, is so as I can eat it.',
    'ForwardEmail'      => 'honey@bear-alliance.co.uk',
    'ForwardUrl'        => 'http://bear-alliance.co.uk/honey-donations/',
    'ContactGroupIDs'   => array('honey lovers')
);

$curl = curl_init('https://app.tellmycell.com/keywords/honey?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
echo 'Status: ' . $json->Response->Status . "\n" .
     'Keyword ID: ' . $json->Response->Entry->ID . "\n" .
     'Keyword: ' . $json->Response->Entry->Keyword . "\n" .
     'Is double opt-in enabled: ' . (int) $json->Response->Entry->EnableDoubleOptIn . "\n" .
     'Confirm message: ' . $json->Response->Entry->ConfirmMessage . "\n" .
     'Join message: ' . $json->Response->Entry->JoinMessage . "\n" .
     'Forward email: ' . $json->Response->Entry->ForwardEmail . "\n" .
     'Forward url: ' . $json->Response->Entry->ForwardUrl . "\n" .
     'Groups: ' . implode(', ' , $json->Response->Entry->ContactGroupIDs) . "\n";

?>
                      




Cancel A Keyword

Cancels an active Keyword on TellMyCell's short code.
PHP - XML
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/keywords/honey?format=xml&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
curl_exec($curl);

echo 'Status: ' . curl_getinfo($curl, CURLINFO_HTTP_CODE) . "\n";

curl_close($curl);

?>
                      
PHP - JSON
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/keywords/honey?format=json&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
curl_exec($curl);

echo 'Status: ' . curl_getinfo($curl, CURLINFO_HTTP_CODE) . "\n";

curl_close($curl);

?>
                      




Check Credit Balance

Check whether a Keyword is available to rent on TellMyCell's short code.
PHP - XML
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits/get?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
echo 'Status: ' . $xml->Status . "\n" .
     'Plan credits: ' . $xml->Entry->PlanCredits . "\n" .
     'Anytime credits: ' . $xml->Entry->AnytimeCredits . "\n" .
     'Total: ' . $xml->Entry->TotalCredits . "\n";

?>
                      
PHP - JSON
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits/get?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
echo 'Status: ' . $json->Response->Status . "\n" .
     'Plan credits: ' . $json->Response->Entry->PlanCredits . "\n" .
     'Anytime credits: ' . $json->Response->Entry->AnytimeCredits . "\n" .
     'Total: ' . $json->Response->Entry->TotalCredits . "\n";

?>
                      




Buy Credits

Buys more credits for your account. You may purchase credits using a credit card you have stored in your TellMyCell account, or you may pass credit card details when you call the API.
Stored Credit Card
PHP - XML
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'NumberOfCredits'  => '1000',
    'CouponCode'       => 'honey2011',
    'StoredCreditCard' => '1111'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Credits purchased: ' . $xml->Entry->BoughtCredits . "\n" .
         'Amount charged, $: ' . sprintf("%01.2f", $xml->Entry->Amount) . "\n" .
         'Discount, $: ' . sprintf("%01.2f", $xml->Entry->Discount) . "\n" .
         'Plan credits: ' . $xml->Entry->PlanCredits . "\n" .
         'Anytime credits: ' . $xml->Entry->AnytimeCredits . "\n" .
         'Total: ' . $xml->Entry->TotalCredits . "\n";
}

?>
                      
Stored Credit Card
PHP - JSON
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'NumberOfCredits'  => '1000',
    'CouponCode'       => 'honey2011',
    'StoredCreditCard' => '1111'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Credits purchased: ' . $json->Entry->BoughtCredits . "\n" .
         'Amount charged, $: ' . sprintf("%01.2f", $json->Entry->Amount) . "\n" .
         'Discount, $: ' . sprintf("%01.2f", $json->Entry->Discount) . "\n" .
         'Plan credits: ' . $json->Entry->PlanCredits . "\n" .
         'Anytime credits: ' . $json->Entry->AnytimeCredits . "\n" .
         'Total: ' . $json->Entry->TotalCredits . "\n";
}

?>
                      
Non-Stored Credit Card
PHP - XML
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'NumberOfCredits'  => '1000',
    'CouponCode'       => 'honey2011',
    'FirstName'        => 'Winnie',
    'LastName'         => 'The Pooh',
    'Street'           => 'Hollow tree, under the name of Mr. Sanders',
    'City'             => 'Hundred Acre Woods',
    'State'            => 'New York',
    'Zip'              => '12345',
    'Country'          => 'US',
    'CreditCardTypeID' => 'Visa',
    'Number'           => '4111111111111111',
    'SecurityCode'     => '123',
    'ExpirationMonth'  => '10',
    'ExpirationYear'   => '2017'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
echo 'Status: ' . $xml->Status . "\n" .
     'Credits purchased: ' . $xml->Entry->BoughtCredits . "\n" .
     'Amount charged, $: ' . sprintf("%01.2f", $xml->Entry->Amount) . "\n" .
     'Discount, $: ' . sprintf("%01.2f", $xml->Entry->Discount) . "\n" .
     'Plan credits: ' . $xml->Entry->PlanCredits . "\n" .
     'Anytime credits: ' . $xml->Entry->AnytimeCredits . "\n" .
     'Total: ' . $xml->Entry->TotalCredits . "\n";
?>
                      
Non-Stored Credit Card
PHP - JSON
<?php

$data = array(
    'User'             => 'winnie',
    'Password'         => 'the-pooh',
    'NumberOfCredits'  => '1000',
    'CouponCode'       => 'honey2011',
    'FirstName'        => 'Winnie',
    'LastName'         => 'The Pooh',
    'Street'           => 'Hollow tree, under the name of Mr. Sanders',
    'City'             => 'Hundred Acre Woods',
    'State'            => 'New York',
    'Zip'              => '12345',
    'Country'          => 'US',
    'CreditCardTypeID' => 'Visa',
    'Number'           => '4111111111111111',
    'SecurityCode'     => '123',
    'ExpirationMonth'  => '10',
    'ExpirationYear'   => '2017'
);

$curl = curl_init('https://app.tellmycell.com/billing/credits?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 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);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
echo 'Status: ' . $json->Response->Status . "\n" .
     'Credits purchased: ' . $json->Response->Entry->BoughtCredits . "\n" .
     'Amount charged, $: ' . sprintf("%01.2f", $json->Response->Entry->Amount) . "\n" .
     'Discount, $: ' . sprintf("%01.2f", $json->Response->Entry->Discount) . "\n" .
     'Plan credits: ' . $json->Response->Entry->PlanCredits . "\n" .
     'Anytime credits: ' . $json->Response->Entry->AnytimeCredits . "\n" .
     'Total: ' . $json->Response->Entry->TotalCredits . "\n";

?>
                      



 

Create A Contact

Adds a new Contact to your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'        => 'winnie',
    'Password'    => 'the-pooh',
    'PhoneNumber' => '2123456785',
    'FirstName'   => 'Piglet',
    'LastName'    => 'P.',
    'Email'       => 'piglet@small-animals-alliance.org',
    'Note'        => 'It is hard to be brave, when you are only a Very Small Animal.',
    'Groups'      => array('Friends', 'Neighbors')
);

$curl = curl_init('https://app.tellmycell.com/contacts?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    foreach( $xml->Entry->Groups->children() as $group ) {
        $groups[] = (string) $group;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Contact ID : ' . $xml->Entry->ID . "\n" .
         'Phone Number: ' . $xml->Entry->PhoneNumber . "\n" .
         'First Name: ' . $xml->Entry->FirstName . "\n" .
         'Last Name: ' . $xml->Entry->LastName . "\n" .
         'Email: ' . $xml->Entry->Email . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Source: ' . $xml->Entry->Source . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $xml->Entry->CreatedAt . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'        => 'winnie',
    'Password'    => 'the-pooh',
    'PhoneNumber' => '2123456785',
    'FirstName'   => 'Piglet',
    'LastName'    => 'P.',
    'Email'       => 'piglet@small-animals-alliance.org',
    'Note'        => 'It is hard to be brave, when you are only a Very Small Animal.',
    'Groups'      => array('Friends', 'Neighbors')
);

$curl = curl_init('https://app.tellmycell.com/contacts?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    if ( !empty($json->Entry->Groups) ) {
        $groups = $json->Entry->Groups;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Contact ID : ' . $json->Entry->ID . "\n" .
         'Phone Number: ' . $json->Entry->PhoneNumber . "\n" .
         'First Name: ' . $json->Entry->FirstName . "\n" .
         'Last Name: ' . $json->Entry->LastName . "\n" .
         'Email: ' . $json->Entry->Email . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Source: ' . $json->Entry->Source . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $json->Entry->CreatedAt . "\n";
}

?>
                        


 

 

Update A Contact

Update a Contact in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'        => 'winnie',
    'Password'    => 'the-pooh',
    'PhoneNumber' => '2123456785',
    'FirstName'   => 'Piglet',
    'LastName'    => 'P.',
    'Email'       => 'piglet@small-animals-alliance.org',
    'Note'        => 'It is hard to be brave, when you are only a Very Small Animal.',
    'Groups'      => array('Friends', 'Neighbors')
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b5720734fada368000000?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    foreach( $xml->Entry->Groups->children() as $group ) {
        $groups[] = (string) $group;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Contact ID : ' . $xml->Entry->ID . "\n" .
         'Phone Number: ' . $xml->Entry->PhoneNumber . "\n" .
         'First Name: ' . $xml->Entry->FirstName . "\n" .
         'Last Name: ' . $xml->Entry->LastName . "\n" .
         'Email: ' . $xml->Entry->Email . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Source: ' . $xml->Entry->Source . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $xml->Entry->CreatedAt . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'        => 'winnie',
    'Password'    => 'the-pooh',
    'PhoneNumber' => '2123456785',
    'FirstName'   => 'Piglet',
    'LastName'    => 'P.',
    'Email'       => 'piglet@small-animals-alliance.org',
    'Note'        => 'It is hard to be brave, when you are only a Very Small Animal.',
    'Groups'      => array('Friends', 'Neighbors')
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b5720734fada368000000?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    if ( !empty($json->Entry->Groups) ) {
        $groups = $json->Entry->Groups;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Contact ID : ' . $json->Entry->ID . "\n" .
         'Phone Number: ' . $json->Entry->PhoneNumber . "\n" .
         'First Name: ' . $json->Entry->FirstName . "\n" .
         'Last Name: ' . $json->Entry->LastName . "\n" .
         'Email: ' . $json->Entry->Email . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Source: ' . $json->Entry->Source . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $json->Entry->CreatedAt . "\n";
}

?>
                        

 

 

Delete A Contact

Delete a Contact in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b52fd734fada068000000?format=xml&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

if ( !empty($response) ) {
    $xml = new SimpleXMLElement($response);
    if ( 'Failure' == $xml->Status ) {
        $errors = array();
        foreach( $xml->Errors->children() as $error ) {
            $errors[] = (string) $error;
        }

        echo 'Status: ' . $xml->Status . "\n" .
             'Errors: ' . implode(', ' , $errors) . "\n";
    }
} else {
    echo 'Status: Success' . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh'
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b52fd734fada068000000?format=json&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

if ( !empty($response) ) {
    $json = json_decode($response);
    $json = $json->Response;

    if ( 'Failure' == $json->Status ) {
        $errors = array();
        if ( !empty($json->Errors) ) {
            $errors = $json->Errors;
        }

        echo 'Status: ' . $json->Status . "\n" .
             'Errors: ' . implode(', ' , $errors) . "\n";
    }
} else {
    echo 'Status: Success' . "\n";
}

?>
                        

 

 

Get All Contacts

Return a list of all Contacts in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'source'        => 'upload',
    'optout'        => false,
    'group'         => 'Honey Lovers',
    'sortBy'        => 'PhoneNumber',
    'sortDir'       => 'asc',
    'itemsPerPage'  => '10',
    'page'          => '3',
);

$curl = curl_init('https://app.tellmycell.com/contacts?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} elseif (! $xml->Entries->children() ) {
    echo 'Status: ' . $xml->Status . "\n" .
         'Search has returned no results' . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Total results: ' . $xml->Entries->children()->count() . "\n\n";

    foreach ( $xml->Entries->children() as $contact ) {
        $groups = array();
        foreach( $contact->Groups->children() as $group ) {
            $groups[] = (string) $group;
        }

        echo 'Contact ID : ' . $contact->ID . "\n" .
             'Phone Number: ' . $contact->PhoneNumber . "\n" .
             'First Name: ' . $contact->FirstName . "\n" .
             'Last Name: ' . $contact->LastName . "\n" .
             'Email: ' . $contact->Email . "\n" .
             'Note: ' . $contact->Note . "\n" .
             'Source: ' . $contact->Source . "\n" .
             'Opted Out: ' . ($contact->OptOut ? 'true' : 'false') . "\n" .
             'Groups: ' . implode(', ' , $groups) . "\n" .
             'CreatedAt: ' . $contact->CreatedAt . "\n\n";
    }
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'source'        => 'upload',
    'optout'        => false,
    'group'         => 'Honey Lovers',
    'sortBy'        => 'PhoneNumber',
    'sortDir'       => 'asc',
    'itemsPerPage'  => '10',
    'page'          => '3',
);

$curl = curl_init('https://app.tellmycell.com/contacts?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} elseif ( empty($json->Entries) ) {
    echo 'Status: ' . $json->Status . "\n" .
         'Search has returned no results' . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Total results: ' . count($json->Entries) . "\n\n";

    foreach ( $json->Entries as $contact ) {
        $groups = array();
        if ( !empty($contact->Groups) ) {
            $groups = $contact->Groups;
        }

        echo 'Contact ID : ' . $contact->ID . "\n" .
             'Phone Number: ' . $contact->PhoneNumber . "\n" .
             'First Name: ' . $contact->FirstName . "\n" .
             'Last Name: ' . $contact->LastName . "\n" .
             'Email: ' . $contact->Email . "\n" .
             'Note: ' . $contact->Note . "\n" .
             'Source: ' . $contact->Source . "\n" .
             'Opted Out: ' . ($contact->OptOut ? 'true' : 'false') . "\n" .
             'Groups: ' . implode(', ' , $groups) . "\n" .
             'CreatedAt: ' . $contact->CreatedAt . "\n\n";
    }
}

?>
                        

 


 

Get A Contact

Return a single Contact in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b52fd734fada068000000?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    foreach( $xml->Entry->Groups->children() as $group ) {
        $groups[] = (string) $group;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Contact ID : ' . $xml->Entry->ID . "\n" .
         'Phone Number: ' . $xml->Entry->PhoneNumber . "\n" .
         'First Name: ' . $xml->Entry->FirstName . "\n" .
         'Last Name: ' . $xml->Entry->LastName . "\n" .
         'Email: ' . $xml->Entry->Email . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Source: ' . $xml->Entry->Source . "\n" .
         'Opted Out: ' . ($xml->Entry->OptOut ? 'true' : 'false') . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $xml->Entry->CreatedAt . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'     => 'winnie',
    'Password' => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/contacts/4f0b52fd734fada068000000?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    $groups = array();
    if ( !empty($json->Entry->Groups) ) {
        $groups = $json->Entry->Groups;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Contact ID : ' . $json->Entry->ID . "\n" .
         'Phone Number: ' . $json->Entry->PhoneNumber . "\n" .
         'First Name: ' . $json->Entry->FirstName . "\n" .
         'Last Name: ' . $json->Entry->LastName . "\n" .
         'Email: ' . $json->Entry->Email . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Source: ' . $json->Entry->Source . "\n" .
         'Opted Out: ' . ($json->Entry->OptOut ? 'true' : 'false') . "\n" .
         'Groups: ' . implode(', ' , $groups) . "\n" .
         'CreatedAt: ' . $json->Entry->CreatedAt . "\n";
}

?>
                        

 


 

Create A Group

Adds a new Group to your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
    'Name'      => 'Tubby Bears',
    'Note'      => 'A bear, however hard he tries, grows tubby without exercise',
);

$curl = curl_init('https://app.tellmycell.com/groups?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Group ID : ' . $xml->Entry->ID . "\n" .
         'Name: ' . $xml->Entry->Name . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Number of Contacts: ' . $xml->Entry->ContactCount . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
    'Name'      => 'Tubby Bears',
    'Note'      => 'A bear, however hard he tries, grows tubby without exercise',
);

$curl = curl_init('https://app.tellmycell.com/groups?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Group ID : ' . $json->Entry->ID . "\n" .
         'Name: ' . $json->Entry->Name . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Number of Contacts: ' . $json->Entry->ContactCount . "\n";
}

?>
                        


 

 

Update A Group

Update a Group in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
    'Name'      => 'Tubby Bears',
    'Note'      => 'A bear, however hard he tries, grows tubby without exercise',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=xml');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Group ID : ' . $xml->Entry->ID . "\n" .
         'Name: ' . $xml->Entry->Name . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Number of Contacts: ' . $xml->Entry->ContactCount . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
    'Name'      => 'Tubby Bears',
    'Note'      => 'A bear, however hard he tries, grows tubby without exercise',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=json');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Group ID : ' . $json->Entry->ID . "\n" .
         'Name: ' . $json->Entry->Name . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Number of Contacts: ' . $json->Entry->ContactCount . "\n";
}

?>
                        

 

 

Delete A Group

Delete a Group in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=xml&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

if ( !empty($response) ) {
    $xml = new SimpleXMLElement($response);
    if ( 'Failure' == $xml->Status ) {
        $errors = array();
        foreach( $xml->Errors->children() as $error ) {
            $errors[] = (string) $error;
        }

        echo 'Status: ' . $xml->Status . "\n" .
             'Errors: ' . implode(', ' , $errors) . "\n";
    }
} else {
    echo 'Status: Success' . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=json&_method=DELETE');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

if ( !empty($response) ) {
    $json = json_decode($response);
    $json = $json->Response;

    if ( 'Failure' == $json->Status ) {
        $errors = array();
        if ( !empty($json->Errors) ) {
            $errors = $json->Errors;
        }

        echo 'Status: ' . $json->Status . "\n" .
             'Errors: ' . implode(', ' , $errors) . "\n";
    }
} else {
    echo 'Status: Success' . "\n";
}

?>
                        

 

 

Get All Groups

Return a list of all Groups in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'sortBy'        => 'Name',
    'sortDir'       => 'asc',
    'itemsPerPage'  => '10',
    'page'          => '3',
);

$curl = curl_init('https://app.tellmycell.com/groups?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} elseif (! $xml->Entries->children() ) {
    echo 'Status: ' . $xml->Status . "\n" .
         'Search has returned no groups' . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Total results: ' . $xml->Entries->children()->count() . "\n\n";

    foreach ( $xml->Entries->children() as $group ) {
        echo 'Group ID : ' . $group->ID . "\n" .
             'Name: ' . $group->Name . "\n" .
             'Note: ' . $group->Note . "\n" .
             'Number of Contacts: ' . $group->ContactCount . "\n\n";
    }
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'          => 'winnie',
    'Password'      => 'the-pooh',
    'sortBy'        => 'Name',
    'sortDir'       => 'asc',
    'itemsPerPage'  => '10',
    'page'          => '3',
);

$curl = curl_init('https://app.tellmycell.com/groups?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} elseif ( empty($json->Entries) ) {
    echo 'Status: ' . $json->Status . "\n" .
         'Search has returned no results' . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Total results: ' . count($json->Entries) . "\n\n";

    foreach ( $json->Entries as $group ) {
        echo 'Group ID : ' . $group->ID . "\n" .
             'Name: ' . $group->Name . "\n" .
             'Note: ' . $group->Note . "\n" .
             'Number of Contacts: ' . $group->ContactCount . "\n\n";
    }
}

?>
                        

 


 

Get A Group

Return a single Group in your TellMyCell account.
PHP - XML
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=xml&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$xml = new SimpleXMLElement($response);
if ( 'Failure' == $xml->Status ) {
    $errors = array();
    foreach( $xml->Errors->children() as $error ) {
        $errors[] = (string) $error;
    }

    echo 'Status: ' . $xml->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $xml->Status . "\n" .
         'Group ID : ' . $xml->Entry->ID . "\n" .
         'Name: ' . $xml->Entry->Name . "\n" .
         'Note: ' . $xml->Entry->Note . "\n" .
         'Number of Contacts: ' . $xml->Entry->ContactCount . "\n";
}

?>
                        
PHP - JSON
<?php

$data = array(
    'User'      => 'winnie',
    'Password'  => 'the-pooh',
);

$curl = curl_init('https://app.tellmycell.com/groups/162467?format=json&' . http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response);
$json = $json->Response;

if ( 'Failure' == $json->Status ) {
    $errors = array();
    if ( !empty($json->Errors) ) {
        $errors = $json->Errors;
    }

    echo 'Status: ' . $json->Status . "\n" .
         'Errors: ' . implode(', ' , $errors) . "\n";
} else {
    echo 'Status: ' . $json->Status . "\n" .
         'Group ID : ' . $json->Entry->ID . "\n" .
         'Name: ' . $json->Entry->Name . "\n" .
         'Note: ' . $json->Entry->Note . "\n" .
         'Number of Contacts: ' . $json->Entry->ContactCount . "\n";
}

?>