PHP Classes

File: getcontacts.php

Recommend this page to a friend!
  Classes of Andy Dixon   Textlocal   getcontacts.php   Download  
File: getcontacts.php
Role: Example script
Content type: text/plain
Description: Get Contacts
Class: Textlocal
Send SMS or MMS messages using Textlocal API
Author: By
Last change:
Date: 10 years ago
Size: 667 bytes
 

Contents

Class file image Download
<?php
require('../textlocal.class.php');

$textlocal = new Textlocal('demo@txtlocal.com', 'apidemo123');

$groupId = 228839;
$startPos = 0;
$limit = 1000;

try {
   
$result = $textlocal->getContacts($groupId, $limit, $startPos);

   
/** Loop through contacts */
   
foreach ($result->contacts as $contact) {
       
$number = $contact->number;
       
$firstName = $contact->first_name;
       
$lastName = $contact->last_name;
       
$custom1 = $contact->custom1;
       
$custom2 = $contact->custom2;
       
$custom3 = $contact->custom3;
    }

   
print_r($result);
} catch (
Exception $e) {
    die(
'Error: ' . $e->getMessage());
}
?>