# Use lead information on php page

**URL:** <https://forum.mautic.org/t/use-lead-information-on-php-page/3249>\
**Category:** Development\
**Created:** [January 19, 2016, 5:21am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249 "2016-01-19T05:21:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bas\_Hekking](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@Bas\_Hekking](https://forum.mautic.org/u/Bas_Hekking)\
**Post date:** [January 19, 2016, 5:21am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249/1 "2016-01-19T05:21:37Z")

</div>

Hi,  
  
  
  
First of all, thanks for this great product! I’ve been looking for this for a long time.  
  
  
  
Is there a way to extract lead information for the current visitor in php? I would like to create a custom/personal page, and show information targeted for a lead profile type. So for example, suppose I have a site for selling books. When a lead has often through the thriller section, then I would like to display on the homepage the newest thriller titles.  
  
  
  
My end goal is to have this available as a module in Drupal 8. Any help would be greatly appreciated.  
  
  
  
Kind regards,  
  
  
  
Bas Hekking

---

<div class="post-metadata">

**Author:** ![Bas\_Hekking](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@Bas\_Hekking](https://forum.mautic.org/u/Bas_Hekking)\
**Post date:** [January 19, 2016, 5:21am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249/2 "2016-01-19T05:21:37Z")

</div>

Hi,

First of all, thanks for this great product! I’ve been looking for this for a long time.

Is there a way to extract lead information for the current visitor in php? I would like to create a custom/personal page, and show information targeted for a lead profile type. So for example, suppose I have a site for selling books. When a lead has often through the thriller section, then I would like to display on the homepage the newest thriller titles.

My end goal is to have this available as a module in Drupal 8. Any help would be greatly appreciated.

Kind regards,

Bas Hekking

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [January 20, 2016, 9:47am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249/3 "2016-01-20T09:47:39Z")

</div>

Sure it is possible. Take a look at the [Mautic API](https://developer.mautic.org/#rest-api) and maybe you’d want to use the current [Mautic-Drupal Module](https://github.com/mautic/mautic-drupal/) as a base.

---

<div class="post-metadata">

**Author:** ![Bas\_Hekking](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@Bas\_Hekking](https://forum.mautic.org/u/Bas_Hekking)\
**Post date:** [January 23, 2016, 10:13am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249/4 "2016-01-23T10:13:03Z")

</div>

Hi Escopecz,

Thanks for your answer. I’ve just tried the rest-api, which works fine. However, how can I identify the lead is on a page? Which $filter should I use for $leadApi-\>getList($filter)?  
Is a filter on IP address the only option? There should be a better way I hope, since several people/leads could be using the same IP.

I tried $filter = ‘ipAddresses:’.$\_SERVER[‘REMOTE\_ADDR’] , but this doesn’t work since the ipAddress field is an array?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [January 23, 2016, 11:14am UTC](https://forum.mautic.org/t/use-lead-information-on-php-page/3249/5 "2016-01-23T11:14:04Z")

</div>

Never thought of getting a current lead. Mautic uses also a cookie ID as a higher layer identifier. Email is above that. But maybe you’d need some Mautic core change to search by a cookie ID if it is not available. A pull request with such functionality would be very welcome.
