Skip to content

Instantly share code, notes, and snippets.

@omidnasri
Created May 26, 2019 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omidnasri/f6d46bffcb2e553496c6ec8997273b3a to your computer and use it in GitHub Desktop.
Save omidnasri/f6d46bffcb2e553496c6ec8997273b3a to your computer and use it in GitHub Desktop.
A simple solution to search and find the person.
<?php
/**
* Target: SearchPerson
*
* Authors: Omid Nasri
*
* Description: A simple solution to search and find the person.
*
* Version: 1.0
*/
try
{
// Enter the field with the username and password that has the necessary permission to find the person.
$username = 'admin';
$password = 'admin';
// Replace <url> keyword to your CRM host address.
$url = 'http(s)://<url>/services/api/IPerson.svc?wsdl';
// Create new instance of SoapClient to call SearchPerson method.
$soapClient = new SoapClient( $url );
$params = array(
'username' => $username,
'password' => $password,
'typeKey' => 'defaultIdentity',
'query' => 'CustomerNo="1025666"'
);
// Calling the SearchPerson method.
$Result = $soapClient->SearchPerson( $params );
// Checked that the operation was successful or not.
if ($Result->SearchPersonResult->Success)
{
//Converting Object to JSON type then print output vlaue.
echo json_encode($Result, JSON_UNESCAPED_UNICODE);
}
else
echo $Result->SearchPersonResult->Message;
}
catch ( Exception $e )
{
// Print exception message
echo $e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment