UFO
UFO

Reputation: 410

Array and String as Parameter for Soap in PHP

I can't pass array and string as parameter in a variable.

Following is my code which is not working as expected.

$wsdlParams = array(
        array(     
            'webserviceid' => $WebServiceID,
            'webservicepass' =>  $WebServicePassword
        ),$fde);

    $soapclient = new SoapClient($WebServiceURL);
    $soapresult = $soapclient->MyInfo($wsdlParams);

Working One:

$soapclient = new SoapClient($WebServiceURL);
$soapresult = $soapclient->MyInfo(array('webserviceid' => $WebServiceID,'webservicepass' => $WebServicePassword),$fde);

Upvotes: 0

Views: 46

Answers (1)

Nick
Nick

Reputation: 147166

You need to use the ... (splat) operator to expand your array of parameters into the necessary two arguments for myInfo:

$soapresult = $soapclient->MyInfo(...$wsdlParams);

Upvotes: 1

Related Questions