# Legacy API key migration - PHP ISDK

**URL:** <https://integration.keap.com/t/legacy-api-key-migration-php-isdk/93190>\
**Category:** API Q&A\
**Created:** [September 20, 2024, 3:49pm UTC](https://integration.keap.com/t/legacy-api-key-migration-php-isdk/93190 "2024-09-20T15:49:54Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Pav](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/pav/32/124_2.png) [@Pav](https://integration.keap.com/u/Pav)\
**Post date:** [September 20, 2024, 11:01pm UTC](https://integration.keap.com/t/legacy-api-key-migration-php-isdk/93190/7 "2024-09-20T23:01:33Z")

</div>

@Farrukh_Naseem, if you look at Marion code you will see what he has done.

If you are using the original XML-RPC Library with the SDK then that will need upgrading.  
The Newer Version of the XML-RPC Library has support for Customisable Headers.

I posted a reply to Marion in which you can use that instead of modifying the library.

> [@Legacy Key Sunsetting](https://integration.keap.com/t/legacy-key-sunsetting/92790/41):
>
> @Marion_Dorsett2, nice work in getting an initial version of the Legacy iSDK supported with the changes. For your reference you can avoid modifying the PHP XML-RPC library by using one of its newer features in setting the cURL HTTP Header. It is not made obvious, but you have to supply the Original Header that it would sent plus the additional header lines, which would be the X-Keap-API-Key or Authorization Bearer. For the Legacy Key / Service Account Key you can set up the Header as this. $…

I made changes to the “methodCaller” function. Here is what I changed to work with the latest XML-RPC Library.

```php
        // * Original Way *
        // $call = $this->xmlrpc_request($service, $callArray);
        // array_unshift($call->params, $this->encKey);
 
        /* Set up the call */
        // 2023-06-05 - Fix to make it work for the PHP XML-RPC library v4.10.1 as "params" is not exposed anymore.
         $call = $this->xmlrpc_request($service, array_merge([$this->xmlrpc_encode($this->key)], $callArray));

        // Check the OAuth Token to see if it needs to be refreshed prior to the call.
        $headers = 
        [
            "Content-Type: text/xml",
            "Accept-Charset: UTF-8,ISO-8859-1,US-ASCII",
            "Expect:",
            "X-Keap-API-Key: {$this->key}"
        ];

         $this->client->setOption('extracurlopts', [CURLOPT_HTTPHEADER => $headers]);

```

My iSDK has been modified over the years, so it is not the same as the original one.

---

_[View the full topic](https://integration.keap.com/t/legacy-api-key-migration-php-isdk/93190)._
