SitePoint Sponsor

User Tag List

Results 1 to 20 of 20

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SMS Based Registration System problem response message via SMS

    Hi;

    I am a newbie in developing an SMS Based system particularly in the use of php nusoap libraries. Right now i am having difficulty achieving success in testing my SMS system. What i am trying to do was that i want to register as a user using SMS by texting REG NAME AGE LOCALCHURCH DISTRICT and send to 23730731 my access code. Here's what i did:
    ***Register.php***

    Code PHP:
    <?php
    // This will allow user to register via SMS.
    error_reporting(0);
     
     
    // load the nusoap libraries. These are slower than those built in PHP5 but don't require you to recompile PHP
    include_once('nusoap.php');
     
    // create the client and define the URL endpoint
    $client = new nusoap_client('http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform/');
     
    // set the character encoding, utf-8 is the standard.
    $client->soap_defencoding = 'UTF-8';
    $client->call('sendSMS', array( 'uName' => '48dwi5',
    'uPin' => '159597',
    'MSISDN' => '09152886810',
    'messageString' => 'Registered Successfully',
    'Display' => '1',
    'udh' => '',
    'mwi' => '',
    'coding' => '0' ),
    "http://ESCPlatform/xsd");
    ?>

    Here is also the xml format of texting SMS via 23730731.
    Code XML:
    <?xml version="1.0" encoding="utf-8"?>
    <message>
    <param>
          <name>id</name>
          <value>2373094420110106170141</value>
    </param>
       <param>
          <name>messageType</name>
          <value>SMS</value>
       </param>
       <param>
          <name>target</name>
          <value>23730731</value>
       </param>
       <param>
          <name>source</name>
          <value>09152886810</value>
       </param>
       <param>
          <name>msg</name>
          <value>REG</value>
       </param>
       <param>
              <name>msg</name> 
    	  <value>NAME</value> 
      </param>
     <param>
    	 <name>msg</name>
    	 <value>AGE</value> 
     </param> 
    <param> 
    	 <name>msg</name>
    	 <value>LOCAL CHURCH</value> 
        </param> 
           <param>
    	 <name>msg</name>
    	 <value>DISTRICT</value>
          </param>
          <param>
          <name>udh</name>
          <value></value>
       </param>
       </message>

    After registration,they will receive a confirmation that they successfully registered as user and they will be allowed to inquire via SMS. Here's the my php code:
    ***inquire.php***

    Code PHP:
    <?php
    // This will allow user to inquire about the latest news within the organization.
    // load the nusoap libraries. These are slower than those built in PHP5 but don't require you to recompile PHP
    require_once('nusoap.php');
    $client = new nusoap_client('http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform/sendSMS');
    // set the character encoding, utf-8 is the standard.
    $client->soap_defencoding = 'UTF-8';
    // Call the SOAP method, note the definition of the xmlnamespace as the third parameter in the call and how the posted message is added to the message string
     $client->call('sendSMS', array( 'uName' => '48dwi5', 
    'uPin' => '159597', 
    'MSISDN' => '09152886810', 
    'messageString' => 'Summer Camp 2013', 
    'Display' => '1', 
    'udh' => '', 
    'mwi' => '', 
    'coding' => '0' ), 
    "http://ESCPlatform/xsd");
     
    ?>

    Here's the xml format of sending inquiries via SMS. They will send INQ EVENT LOCATION TIME send to 23730731.
    Code XML:
    <?xml version="1.0" encoding="utf-8"?>
    <message>
       <param>
       <name>id</name>
          <value>2373094420110106170141</value>
     
       </param>
       <param>
          <name>messageType</name>
          <value>SMS</value>
       </param>
       <param>
          <name>target</name>
          <value>23730731</value>
       </param>
       <param>
          <name>source</name>
          <value>09152886810</value>
       </param>
       <param>
          <name>msg</name>
          <value>event</value>
       </param>
    <param>
          <name>msg</name>
          <value>location</value>
       </param>
     
    <param>
          <name>msg</name>
          <value>time</value>
       </param>
     
     
       <param>
          <name>udh</name>
          <value></value>
       </param>
    </message>

    Here's my callback URL to receive the message sent:

    Code PHP:
    <?php
     
    function send($number,$client)
    {
     
    $x=send("09152886810",$client);
    echo $x;
    }
     
    # Load XML string from input
    
    $xml = simplexml_load_file('php://input');
     
    # Parse the XML for parameters
    
    $sms = array();
    $nodes = $xml->xpath('/message/param');
     
    foreach($nodes as $node)
     {
       $param = (array) $node;
     
    $sms[$param['name']] = $param['value'];
     
    }
     
     
     
     
    if($sms['messageType'] == 'SMS-NOTIFICATION') {
    send();
     
    list($action, $messagetype, $source, $type) =explode ("     ",$client); 
     
     
     
     
    }elseif($sms['messageType'] == 'SMS') {
     
     
     
    send();   
    list($action, $name, $age, $localchurch, $district) = explode(" ",$client); 
     
     
    }elseif($sms['messageType'] == 'SMS') {
     
     
    send(); 
    list($action, $event,$location,$time) = explode("     ", $client);
     
     
     
    }
    else {
       echo "Unsupported Message Type";
     
    }
     
     
     
     
    ?>
    Last edited by Mittineague; Apr 17, 2013 at 13:56. Reason: reformatting bbcode tags


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •