0

I try to post data in order to create contact on hubspot with ColdFusion 7:

<cfset hutk = "#cookie.hubspotutk#">
<cfset pageUrl = "http://www.example.com">
<cfset pageName = "the page name">
<cfset ipAddress = "#url.client_ip#">
<cfset post = {}>
<cfset post['email'] = "#url.email#">
<cfset post['firstname'] = "#url.first_name#">
<cfset post['lastname'] = "#url.last_name#">
<cfset post['company'] = "#url.company#">
<cfset post['website'] = "M1_Website">
<cfset post['phone'] = "#url.phone#">
<cfset post['country'] = "#countrycode#">
<cfset post['owner'] = "#url.owner#">

<cfset hs_context = {}>
<cfset hs_context['hutk'] = #hutk#>
<cfset hs_context['ipAddress'] = #ipAddress#>
<cfset hs_context['pageUrl'] = #pageUrl#>
<cfset hs_context['pageName'] = #pageName#>
<cfset post['hs_context'] = #serializeJSON(hs_context)#>

<cfhttp url="https://forms.hubspot.com/uploads/form/v2/XXXXXX/XXXXXX-XXXXXXX-XXXX-XXXX-XXXXXXXXXX" method="post" result="httpResp" timeout="120">
    <cfhttpparam type="header" name="Accept" value="application/json" />
    <cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" />
    <cfhttpparam type="body" value = post>
</cfhttp>

<cfoutput> #httpResp.FileContent# </cfoutput>

But i get this output:

Connexion Failure

Any idea of what I'm doing wrong?

Marc El Bichon
  • 397
  • 1
  • 7
  • 24
  • Probably not related to your error, but I don't think CF 7 supports this syntax: ` `. – Dan Bracuk Jan 31 '17 at 12:06
  • Please [edit your question](http://stackoverflow.com/posts/41953337/edit) and include the full error message. Also, please post your CF version: `` – Leigh Feb 01 '17 at 01:36

0 Answers0