PHP Code Examples For The Club Texting APIs:
Sending SMS Messages - Code Examples:
Single Message
<?php $ch=curl_init('https://app.clubtexting.com/api/sending'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&phonenumber=2127846500&subject=test&message=test message&express=1"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Multiple Messages
<?php /* The below code snippet is a sample and not functional. Its purpose is to illustrate how to send multiple requests to our service using one connection */ $ch = curl_init('https://app.clubtexting.com/api/sending'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); foreach ($messages as $message) { $post = "user=username&pass=userpassword&phonenumber=" . $message['phone'] . "&subject=" . $message['subject'] . "&message=" . $message['message'] . "&express=1"; curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); } curl_close($ch); ?>
Receiving Keyword Submissions - Code Examples:<?php $sender = $_GET['PhoneNumber']; $message = $_GET['Message']; if ($sender!='') { // Save incoming messages $fp = fopen("receivelog.txt","a"); fputs($fp,"$sender $message\n"); fclose($fp); // Return a response SMS message $responsetext = "Thank you for the message!"; echo "{SMS:TEXT}{}{}{".$sender."}{".$responsetext."}"; } else { echo "The PHP script is waiting for messages"; } ?>
Check Credit Balance - Code Examples:<?php $ch = curl_init('https://app.clubtexting.com/api/credits/check'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Check Keyword Availability - Code Examples:<?php $ch = curl_init('https://app.clubtexting.com/api/keyword/check'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&keyword= userkeyword"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Buy More Credits - Code Examples:<?php $ch = curl_init('https://app.clubtexting.com/api/credits/buy'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&credits=5&firstname=firstname&lastname=lastname&address=address&city=newyork&state=ny&zip=08902&country=usa&type=visa&ccnumber=rIhLJUiXl8M0JIcrelxH9A&cccode=111&expm=11&expy=12"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Rent a Keyword: - Code Examples<?php $ch = curl_init('https://app.clubtexting.com/api/keyword/rent'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&keyword=keywordtorent&firstname=firstname&lastname=lastname&address=address&city=newyork&state=ny&zip=08902&country=usa&type=visa&ccnumber=rIhLJUiXl8M0JIcrelxH9A&expm=11&expy=2012"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Configure a Keyword - Code Examples:
<?php $ch = curl_init('https://app.clubtexting.com/api/keyword/setup/'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&keyword=keywordtoconfigure&group=test&autoreply=autoreply&url=http://test.com/test"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Voice Broadcast - Code Examples:
(Single Number)<?php $ch = curl_init('https://app.clubtexting.com/api/voicemessages/'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=password&phonenumbers=2127846500&soundsource=http://mydomain.com/sounds/voice.wav &callerid=2127847840"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>(Single Number 2nd Example)
<?php $ch = curl_init('https://app.clubtexting.com/api/voicemessages/'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=password&phonenumbers=2127846500&soundfile=1236019718.wav &callerid=2127847840"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>(An Array Of Numbers)
<?php $ch = curl_init('https://app.clubtexting.com/api/voicemessages/'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=password&phonenumbers[]=phone1&phonenumbers[]=phone2&phonenumbers[]=phone3&soundfile=1236019718.wav&callerid=2127847840"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
Receiving Inbox Message Replies - Code Examples:<?php $sender = $_GET['from']; $message = $_GET['message']; if ($sender!='') { // Save incoming messages $fp = fopen("forwardlog.txt","a"); fputs($fp,"$sender $message"); fclose($fp); } ?>
Carrier Lookup - Code Examples:<?php $ch=curl_init('https://app.clubtexting.com/api/lookup'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&phonenumber= 2127846500"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print(); /* result of API call*/ ?>
Developer Center
·Developer Center Home·Bulk SMS API Documentation
·Frequently Asked Questions
Code Examples
·C#
·Java
·Perl
·PHP
·Python
·Ruby
LIVE SALES & SUPPORT
(Monday to Friday, 9am - 7pm EST
Get Started With Our Text
Message Marketing Video
CLUB TEXTING CLIENTS
Read What Our Clients
Are Saying About Us!


