# Contact create API -\> CURLOPT\_POSTFIELDS populated with variables

**URL:** <https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [April 1, 2021, 5:27pm UTC](https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873 "2021-04-01T17:27:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASmith3](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/asmith3/32/7115_2.png) [@ASmith3](https://community.hubspot.com/u/ASmith3)\
**Post date:** [April 1, 2021, 5:27pm UTC](https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873/1 "2021-04-01T17:27:04Z")

</div>

Hi,

I am attempting to pass information from my LMS (hosted on WordPress) through to HubSpot. Currently I have it set up such that it can create a new contact by using fixed values (so this function runs after the form submits):

CURLOPT\_POSTFIELDS =\> “{\“properties\”:{\“company\”:\“Alex\”,\“email\”:\“[alex@alex.net](mailto:alex@alex.net)\”,\“firstname\”:\“Alex\”,\“lastname\”:\“Alex\”,\“phone\”:\”(888) 888 888\“,\“website\”:\“[alex.net](http://alex.net)\”}}”,

However, I’d like to be able to submit variables - particularly, the input values from the payment submission.

Attempted this as so:

$email1 = $\_POST[‘email\_address’];

CURLOPT\_POSTFIELDS =\> “{\“properties\”:{\“company\”:\“Alex\”,\“email\”:\$email1,\“firstname\”:\“Alex\”,\“lastname\”:\“Alex\”,\“phone\”:\”(888) 888 888\“,\“website\”:\“[alex.net](http://alex.net)\”}}”,

But no luck. Can anyone advise on how I might solve this?

Thanks!

Alex

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [April 5, 2021, 2:40pm UTC](https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873/2 "2021-04-05T14:40:01Z")

</div>

Hi @ASmith3

Are you still working with this one?

Wanted to throw @tjoyce at it this to help out 😀

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [April 5, 2021, 3:19pm UTC](https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873/3 "2021-04-05T15:19:24Z")

</div>

@ASmith3 - Have you tried

```lia-code-sample
CURLOPT_POSTFIELDS => json_encode([
 'properties' => [
 'company' => 'Alex',
 'email' => $_POST['email_address'],
 'firstname' => 'Alex'
 ]
]);

```

---

<div class="post-metadata">

**Author:** ![ASmith3](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/asmith3/32/7115_2.png) [@ASmith3](https://community.hubspot.com/u/ASmith3)\
**Post date:** [April 5, 2021, 4:27pm UTC](https://community.hubspot.com/t/contact-create-api-curlopt-postfields-populated-with-variables/34873/4 "2021-04-05T16:27:46Z")

</div>

Hi @dennisedson @tjoyce,

That has done it! Thank you so much, I would not like to hazard a guess at how much time that has saved me.

Thank you and have a great rest of the week!

Many thanks,

Alex
