Interacting with the Tessitura web API using PHP can be a daunting task. Maybe this post can help if you're getting started with a PHP site.
Here is a simple PHP function that instantiates a SOAP client to interact with the Tessitura web API.
function getTessituraClient() { try { // TESSITURA_WSDL_LOCATION is a constant may be // useful to define in an external settings file. $tessClient = new SoapClient(TESSITURA_WSDL_LOCATION); } catch (Exception $exception) { // Insert code here to handle when Tessitura API can't be found. } return $tessClient; }
And here is an example of its use in retrieving a constituent's personal information:
$tessClient = getTessituraClient(); try { // This assumes $tessSessionKey has been previously defined. $results = $tessClient->GetAccountInfo(array('sSessionKey'=>$tessSessionKey])); } catch (SoapFault $exception) { // Insert code here to handle the potential failure of the GetAccountInfo() call. } $results = new SimpleXMLElement($results->GetAccountInfoResult->any); // Storing some results in variables. $namePrefix1 = (string) $results->GetAccountInfoResults->AccountInformation->prefix; $firstName1 = (string) $results->GetAccountInfoResults->AccountInformation->fname; $middleName1 = (string) $results->GetAccountInfoResults->AccountInformation->mname; $lastName1 = (string) $results->GetAccountInfoResults->AccountInformation->lname; // ... and so on
I hope this is helpful to someone!
Bryan
Very Cool! Thank you!
You're welcome!