# Link Contacts PHP iSDK example

**URL:** <https://integration.keap.com/t/link-contacts-php-isdk-example/19381>\
**Category:** API Q&A\
**Tags:** linked-contacts\
**Created:** [October 29, 2017, 7:20am UTC](https://integration.keap.com/t/link-contacts-php-isdk-example/19381 "2017-10-29T07:20:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pagedesigner](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/pagedesigner/32/2769_2.png) [@pagedesigner](https://integration.keap.com/u/pagedesigner)\
**Post date:** [October 29, 2017, 7:20am UTC](https://integration.keap.com/t/link-contacts-php-isdk-example/19381/1 "2017-10-29T07:20:34Z")

</div>

Hi, i was exploring IS API docs to find method of ‘Link Contacts’ and was unable to find example here [xml-rpc - Keap Developer Portal](https://developer.infusionsoft.com/docs/xml-rpc/#contact-link-contacts) can anyone tell me is the following example code correct?

```
$contactId1 = 123;
$contactId2 = 456;
$linkTypeId = 789;
$result = $app->linkContacts($contactId1, $contactId2, $linkTypeId);

```

---

<div class="post-metadata">

**Author:** ![pagedesigner](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/pagedesigner/32/2769_2.png) [@pagedesigner](https://integration.keap.com/u/pagedesigner)\
**Post date:** [October 29, 2017, 8:47am UTC](https://integration.keap.com/t/link-contacts-php-isdk-example/19381/2 "2017-10-29T08:47:48Z")

</div>

ok got the answer from [How can I link contacts via the PHP ISDK? - #2 by John\_Borelli](https://integration.keap.com/t/how-can-i-link-contacts-via-the-php-isdk/2935/2) i added following public function in isdk.php and called the above example code and was succesfull:

```
public function linkContacts($contactId1, $contactId2, $contactLinkTypeId){
    $carray = array(
         php_xmlrpc_encode((int) $contactId1),
         php_xmlrpc_encode((int) $contactId2),
         php_xmlrpc_encode((int) $contactLinkTypeId)
    );
    return $this->methodCaller("ContactService.linkContacts", $carray);
}

```
