Wednesday, 13 March 2013

To call packback webservice call to check mobile valid or not

<?php
echo validatePaybackMobile('9949123456');
function validatePaybackMobile($mobile){
    require_once('nusoap.php');
    if(strlen($mobile)!=10){
        $err="Mobile number should be 10 characters";
        return $err;
    }
    $bodyxml = '<?xml version="1.0" encoding="utf-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.payback.net/lmsglobal/ws/v1/extint/types">
       <soapenv:Header/>
       <soapenv:Body>
          <typ:IsMobileLinkedRequest>
             <typ:MobileNumber>'.$mobile.'</typ:MobileNumber>
          </typ:IsMobileLinkedRequest>
       </soapenv:Body>
    </soapenv:Envelope>
    ';
  
  
    $client = new nusoap_client("https://46.51.221.138/PBExternalServices/v1/soap?wsdl",true);
    $err = $client->getError();
      
    $client->soap_defencoding = 'utf-8';
    $client->useHTTPPersistentConnection();
    $bsoapaction = "http://somehost/SubmitCalls";
    $result = $client->send($bodyxml, $bsoapaction);
    if($result['Status']=='YES'){
        return true;
    }
    elseif ($result['Status']=='NO') {
        $err="Mobile number is not exists in payback account, please check in your payback account";
        return $err;
    }else{
        return $err;
    }

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home