0

私は SMS ベースの登録システムを開発していますが、これまでのところシステムをテストする段階にあります。突然、確認メッセージを受信する必要がある SMS 経由で登録しようとしたときに、サーバーからメッセージを受信できませんでした。PHP nusoapを使用したときに私がしたことは次のとおりです。

Register.php

 <?php
 // This will allow user to register via SMS.
 error_reporting( E_ALL );
 // load the nusoap libraries. These are slower than those built in PHP5 but         
 require_once('nusoap.php');

// create the client and define the URL endpoint
 $soapclient = new nusoap_client('http://www.mnccyf.info/soap_book.php?wsdl');

 // set the character encoding, utf-8 is the standard.
  $soapclient->soap_defencoding = 'UTF-8';
  $soapclient->call('sendSMS', array( 'uName' => '48dwi5',
   'uPin' => '159597',
   'MSISDN' => '09152886810',
    'messageString' => 'Registered Successfully',
     'Display' => '1',
     'udh' => '',
     'mwi' => '',
     'coding' => '0' ),
      "http://ESCPlatform/xsd");
      ?>

お問い合わせ.php

   <?php
   // This will allow user to inquire about the latest news within the organization.
    error_reporting( E_ALL );
   // load the nusoap libraries. These are slower than those built in PHP5 but    
    require_once('nusoap.php');
    $soapclient = new nusoap_client('http://www.mnccyf.info/soapquery_server.php?wsdl');

  // set the character encoding, utf-8 is the standard.
   $soapclient->soap_defencoding = 'UTF-8';
   // Call the SOAP method, note the definition of the xmlnamespace as the third       in the call and how the posted message is added to the message string
  $soapclient->call('sendSMS', array( 'uName' => '48dwi5', 
  'uPin' => '159597', 
  'MSISDN' => '09152886810', 
   'messageString' => 'Summer Camp 2013', 
   'Display' => '1', 
    'udh' => '', 
    'mwi' => '', 
    'coding' => '0' ),  
     "http://ESCPlatform/xsd");

   ?>

着信_sms.php

  <?php
   require_once('nusoap.php');
   function sendSMS($number,$soapclient)  
   {

   $x=sendSMS("09152886810",$soapclient);
   }


   # 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') {
    sendSMS();

    list($action, $messagetype, $source, $type) =explode ("     ",$soapclient); 




    }elseif($sms['messageType'] == 'SMS') {



    sendSMS();   
    list($action, $name, $age, $localchurch, $district) = explode(" ",$soapclient); 


    }elseif($sms['messageType'] == 'SMS') {


    sendSMS(); 
    list($action, $event,$location,$time) = explode("     ", $soapclient);



    }
    else {
    echo "Unsupported Message Type";

   }




   ?>

register_soapserver.php

<?php
//call library

require_once ('nusoap.php');

//using soap_server to create server object
$server = new nusoap_server;
$server ->configureWSDL('http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform?
wsdl','urn:http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform?wsdl');
//register a function that works on server
$server->register('reg');

// create the function
function reg()
{
$connect = mysql_connect("localhost","root","jya0312@");

if (!$connect)
{
die("Couldnt connect" . mysql_error());
}

mysql_select_db("cyfdb", $connect);

$sql = "INSERT INTO mydb(name, age,localchurch,district) VALUES ('{$_POST  [name]}','{$_POST[age]}','{$_POST[localchurch]}','{$_POST[district]}')";

mysql_close($connect);

}

// create HTTP listener
$server->service($HTTP_RAW_POST_DATA);

exit();

?>

soapquery_server.php

<?php
//call libraryrequire_once ('nusoap.php');

//using soap_server to create server object
$server = new nusoap_server;
$server ->configureWSDL('http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform?     wsdl','urn:http://iplaypen.globelabs.com.ph:1881/axis2/services/Platform?   wsdl');
//register a function that works on server
$server->register('getquery');

// create the function
function getquery()
{
$link=mysql_connect("localhost", "root", "jya0312@") or die("Cannot connect to DB!");
mysql_select_db("cyfdb") or die("Cannot select DB!");
$sql = "SELECT event,location,time from activity";
while($r = mysql_fetch_array($sql)){
  $items[] = array('event'=>$r['event'],
                      'location'=>$r['location'],
                      'date'=>$r['date']); 
}
return $items;


$mysql_close($link);


}

// create HTTP listener
$server->service($HTTP_RAW_POST_DATA);

exit();
?>
4

0 に答える 0