PHPEveryday.com PHP and Web Development Tutorial
What are you looking for?


SMS : Line Codes Send Simple SMS (Part 2)


After install sms messaging server, now we will test with php. In this tutorial we just write simple code, just for testing. If it pass, we can continue with more complex project and sell it!!!

  1. I create a new folder name sms within www/test directory.
  2. Then, create a new file name smstest.php within sms folder.
  3. Enter following codes in that file:
    <html>
    <head>
    <META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
    <title>ActiveXperts SMS Messaging Server 
    PHP Sample</title>
    </head>
    
    <body>
    
    <form method="get">
    <input type="submit" name="submit" value="Kirim">
    </form>
    
    <?php
    if($_GET['submit']){
      $objConstants = new COM ( "AxSmsServer.Constants" );
      $objMessageDB = new COM ( "AxSmsServer.MessageDB" );
       
      $objMessageDB->Open ();
       
      if ( $objMessageDB->LastError <> 0 )
      {
        $ErrorDes = $objMessageDB->GetErrorDescription ( $objMessageDB->LastError );
    
        die ( $ErrorDes );
      }
    
      $objMessage = $objMessageDB->Create ();
    
      if ( $objMessageDB->LastError <> 0 )
      {
        $ErrorDes = $objMessageDB->GetErrorDescription ( $objMessageDB->LastError );
    
        die ( $ErrorDes );
      }
       
      $objMessage->Direction     = $objConstants->MESSAGEDIRECTION_OUT;
      $objMessage->Type          = $objConstants->MESSAGETYPE_SMS;
      $objMessage->Status        = $objConstants->MESSAGESTATUS_PENDING;
      $objMessage->ChannelID     = 0;
      $objMessage->ScheduledTime = ""; 
      $objMessage->Recipient     = "+6281328562xxx";
      $objMessage->Body          = "SMS Messaging Server - PHP Test SMS";
    
      // Save the Message
     
      $objMessageDB->Save ( $objMessage );
    
      if ( $objMessageDB->LastError <> 0 )
      {
        $ErrorDes = $objMessageDB->GetErrorDescription ( $objMessageDB->LastError );
    
        die ( $ErrorDes );
       }
    
      Echo "Successfully created new SMS Message";
    	}
       ?>
       </body>
    </html>
    

You can change content of line 41 and 42. May, point this sms to your hp self. Change message with your words.

Point your browser to http://localhost/test/sms/smstest.php. You will get a button. Just click. Wait for seconds, if success, you will get message in your handphone from this application.



Series this article:
SMS : Sending SMS with PHP and ActiveXperts (Part 1)
SMS : Line Codes Send Simple SMS (Part 2)


Tag: sms Category: PHP Application Post : December 05th 2007 Read: 4,674 Bookmark and Share

blog comments powered by Disqus


Database Tutorial
  • Learn PHP MySQL
  • Learn PHP ADOdb
  • Learn PHP Data Object/PDO
  • Learn PHP XML
  • Learn PHP SimpleXML
Security Tutorial
  • Learn PHP Security
  • Learn HTTP Authentication
  • Learn PHPSecureSite
Framework Tutorial
  • Learn CodeIgniter
  • Learn Joomla
  • Learn Smarty
  • Learn Zend Framework
Template Tutorial
  • Learn Joomla Template
  • Learn WordPress Template
API Tutorial
  • Learn Facebook
JS Framework Tutorial
  • Learn MooTools
  • Learn JQuery
AJAX Tutorial
  • Learn AJAX in 10 Minutes
  • Learn AJAX Client Side
  • Learn AJAX PHP
  • Learn AJAX Remote Server
  • Learn AJAX Repetitive
  • Learn AJAX MySQL
  • Learn AJAX Grid
Web Services Tutorial
  • Learn Web Services NuSOAP
  • Learn Web Services WSDL
  • Learn Web Services WSDL Array
  • Learn Web Services .NET Grid
  • Learn Web Services WDDX
Package Post
  • Joomla Intro
  • Joomla Component
  • Joomla Module
  • Joomla MVC
  • Joomla MVC Backend
  • PostNuke Intro
  • Zend Framework Intro
  • Zend Framework Action
  • Zend Framework Database
  • Zend Framework Registry
  • Zend Framework Config
  • Zend Framework Login
  • Zend Framework Session
  • PHP Array Tips
  • PHP File Tips
  • PHP Email
  • PHP Ms Excel
  • PHP Pattern
  • PHP SMS
  • Flash Database
  • PHP Multitier
  • jQuery Introduction
  • jQuery Selectors
  • Portable Web Server
  • Web Mobile Intro
  • Drupal Installation
  • Drupal Configuration