# Create new Contact from another server

**URL:** https://forum.mautic.org/t/create-new-contact-from-another-server/19443
**Category:** Product Support
**Created:** [May 12, 2021, 7:48pm UTC](https://forum.mautic.org/t/create-new-contact-from-another-server/19443 "2021-05-12T19:48:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![imihandstand](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imihandstand/32/1499_2.png) [@imihandstand](https://forum.mautic.org/u/imihandstand)
#### Post date: [May 12, 2021, 7:48pm UTC](https://forum.mautic.org/t/create-new-contact-from-another-server/19443/1 "2021-05-12T19:48:51Z")

</div>

**Your software**  
My Mautic version is: 3.3.2  
My PHP version is: 7.3.28

**Your problem**  
My problem is: I want to create a new contact from a PHP-file on another server than Mautic is installed on. I tried (but I’m open to any solution):

- **PHP Curl Class** (based on [https://stackoverflow.com/a/60797655/4024828](https://stackoverflow.com/a/60797655/4024828) )
- **Mautic’s API-Library** : [GitHub - mautic/api-library: Mautic API Library](https://github.com/mautic/api-library)

but I can’t get them to work. I don’t have too much idea about this stuff. For example the problem is probably that I don’t know how to use the “_include **DIR**. '/vendor/autoload.php_’;” in my PHP-file, as Mautic is on another server as said.

Could somebody please help me how to create a new contact from another server via PHP?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [May 13, 2021, 6:22am UTC](https://forum.mautic.org/t/create-new-contact-from-another-server/19443/2 "2021-05-13T06:22:47Z")

</div>

Yes, it is more simple then you think.

This is your data:

```
$email = 'captain_enterprise-d@starfleet.com';
$firstname = 'Jean-Luc';
$lastname = 'Pickard';
$tag = 'purchased';

```

This is our curl call:

```
$curl = curl_init();
// Set some options - we are passing in a user agent too here
  curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL => "https://".$loginname.":".$password."@".$siteurl."/api/contacts/new",
  CURLOPT_USERAGENT => 'Mautic Connector',
  CURLOPT_POST => 1,
// posting the payload
  CURLOPT_POSTFIELDS => array(
    'firstname' => $firstname,
    'lastname' => $lastname,
    'email' => $email,
    'tags' => $tag
  )
));
curl_exec($curl);

```

In case you’d like to dig deeper, I have a detailed description:

> **[Process any webhook with Mautic (without Zapier) \[Updated!\] – Joey Keller](https://joeykeller.com/process-any-webhook-with-mautic-without-zapier/)**

---

<div class="post-metadata">

### Author: ![imihandstand](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imihandstand/32/1499_2.png) [@imihandstand](https://forum.mautic.org/u/imihandstand)
#### Post date: [May 13, 2021, 7:52am UTC](https://forum.mautic.org/t/create-new-contact-from-another-server/19443/3 "2021-05-13T07:52:30Z")

</div>

Fantastic, thank you soo much! It worked perfectly!

Btw, 2 notes you might want to add on your website to this article (as I had trouble figuring these out):

- **"_Enable HTTP basic auth?_"** must be turned on in Mautic
- It doesn’t work if the **password** has special characters like a “.” or a “@” (I had both of these in my pass).

Again, thank you very much for your help!

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [May 13, 2021, 7:58am UTC](https://forum.mautic.org/t/create-new-contact-from-another-server/19443/4 "2021-05-13T07:58:03Z")

</div>

Good points! Thank you!
