Location: PHPKode > projects > MembersGear > membersgear/includes/MembersiteWebservice.php
<?php
/*
 *	$Id: client1.php,v 1.3 2007/11/06 14:48:24 snichol Exp $
 *
 *	Client sample that should get a fault response.
 *
 *	Service: SOAP endpoint
 *	Payload: rpc/encoded
 *	Transport: http
 *	Authentication: none
 */
 
require_once('E:\Projects\SA\PHPProjects\sscMemberSite\config\config.php'); 
//require_once(CONFIG_DIR.'/config.php'); 
require_once(INCLUDE_DIR.'/nusoapwebservice/nusoap.php');

class MembersiteWebserviceClient
{

    var $moClient; 
    
    function __construct()
    {
        $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
        $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
        $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
        $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
        $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';

        $this->moClient = new nusoap_client(PAYGEAR_WEB_URL."/MembersiteWebservice.asmx?WSDL", true,$proxyhost, $proxyport, $proxyusername, $proxypassword);
        //$client = new nusoap_client("http://soap.amazon.com/onca/soap2", false,
        //    $proxyhost, $proxyport, $proxyusername, $proxypassword);
        $err = $this->moClient->getError();
        if ($err) {
            echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
            echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
            exit();
        }
        $this->moClient->setUseCurl($useCURL);
    }
    
    function ViewMasterValue($psMaster)
    {
        $lsMaster = array('Master'=>$psMaster);
        $WebServiceResponse = $this->moClient->call('ViewMasterValues', $lsMaster); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
                return false;
        }
        
        $WebServiceResponse = $WebServiceResponse['ViewMasterValuesResult']['string'];
        
        foreach($WebServiceResponse as $key=>$value)
        {
            $value = explode(',',$value);
            $result[$value[0]] = $value[1];
        }
        
        return $result;
        
    }
    
    function AvailablePaymentProcessors($psPaygearUserName)
    {
        $lsPaygearUserName = array('PaygearUserName'=>$psPaygearUserName);
        $WebServiceResponse = $this->moClient->call('AvailablePaymentProcessors', $lsPaygearUserName); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
            {   //echo $lErr;
                return false;
            }   
        }
        
        $WebServiceResponse = $WebServiceResponse['AvailablePaymentProcessorsResult']['string'];
        //print_r($WebServiceResponse);
        
        foreach($WebServiceResponse as $key=>$value)
        {
            $value = explode(',',$value);
            $result[$value[0]] = $value[1];
        }
        
        return $result;
        
    }
    
    
}

$MembersiteWebserviceClient = new MembersiteWebserviceClient();
print_r($MembersiteWebserviceClient->AvailablePaymentProcessors('hdpatel'));
//echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
?>
Return current item: MembersGear