(PHP) SoapClient class object could not be converted to string
This code works great:
$result = $client->__call("optionalInfo", array(
new SoapParam("...", "client"),
new SoapParam("...", "add_code"))
);
When I try to abstract it a bit to make the script reusable, I get this error:
Allowable fatal error: Object of class SoapClient cannot be converted to string
Broken code:
$params = array( new SoapParam($client, "client"),
new SoapParam($add_code, "add_code")
);
$result = $client->__call($functionName, $params);
The last reason is the problem.
+1
source to share