/
FindPersonById.php
46 lines (41 loc) · 1.35 KB
/
FindPersonById.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Target: FindPersonById
*
* Authors: Omid Nasri
*
* Description: A simple solution to find person by ID.
*
* 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 FindPersonById method.
$soapClient = new SoapClient( $url );
$params = array(
'username' => $username,
'password' => $password,
'personId' => '7752d1da-5699-4226-b8a1-1ee6d20b0fbf'
);
// Calling the FindPersonById method.
$Result = $soapClient->FindPersonById($params);
// Checked that the operation was successful or not.
if ($Result->FindPersonByIdResult->Success)
{
//Converting Object to JSON type then print output vlaue.
echo json_encode($Result, JSON_UNESCAPED_UNICODE);
}
else
echo $Result->FindPersonByIdResult->Message;
}
catch ( Exception $e )
{
// Print exception message
echo $e->getMessage();
}
?>