APIs & Integrations

DaniMarketing
Member

Where to enter API in Joomla - code?

We are using Joomla and Breezing Forms.

0 Upvotes
7 Replies 7
DaniMarketing
Member

Where to enter API in Joomla - code?

The submit form code… we’re trying to pull information from a custom form in Joomla and populate Hubspot. Need to know where to put the code in Joomla.

We tried putting it in the article with the form, but were getting the 204 error (it is showing on the landing page we created also in Joomla) and it is non populating hubspot with the form fields/entering in a new contact.

Thanks!

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Where to enter API in Joomla - code?

@DaniMarketing Are you running the code server side? Also the HTTP response of 204 is not an error it is a success with no content being returned to the caller. If you read the docs below, that is the right response code to get. Have you made the form in hubspot as well to send it too?

0 Upvotes
DaniMarketing
Member

Where to enter API in Joomla - code?

We have no area that says external forms page. And what do you mean by server side? Is there someone we can talk to on developers side… like via phone? This issue has been going on for far too long. We don’t know how to fix it. We need someone to guide us through it. This is becoming immensely frustrating.

Thanks,

Dani

Danielle A. Pingitore
Assistant Marketing Manager
Resource Associates Corporation
50 Commerce Drive | Wyomissing, PA 19610
Call: 800.762.6227 x 1116 | Fax: 610.775.9686

“Creativity is contagious, pass it on.” Albert Einstein

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Where to enter API in Joomla - code?

Server side(code that runs on the web sever) as opposed to anything client side or front end(the browser or code that would execute on the clients machine accessing your site)

I’m assuming you are running it server side as 204 is the correct response code.

Right now this is the only medium of developer support. We do offer some paid consulting services.

My first questions is:

Do you have the form made in HubSpot?

There needs to be a form to send the data to in HubSpot.

DaniMarketing
Member

Where to enter API in Joomla - code?

Hello.

The code I am using is PHP so yes, it is server side. And yes we do have a form in Hubspot that we are using for the input. I am putting this PHP code directly into the article where I have the form syntax, using Sorcerer so as to not alter the code. The front end of the website displays the “204”. While I understand that means it is successful, I don’t think that should be showing on the front end. I am going to paste the code I was using, to see if maybe I am missing something in there.

Thanks.

<?php //Process a new form submission in HubSpot in order to create a new Contact. $hubspotutk = $_COOKIE['hubspotutk']; //grab the cookie from the visitors browser. $ip_addr = $_SERVER['REMOTE_ADDR']; //IP address too. $hs_context = array( 'hutk' => $hubspotutk, 'ipAddress' => $ip_addr, 'pageUrl' => 'http://www.startaconsultingpractice.com', 'pageName' => ‘Start A Consulting Practice’ ); $hs_context_json = json_encode($hs_context); //Need to populate these variable with values from the form. $str_post = "firstname=" . urlencode($FirstName) . "&lastname=" . urlencode($LastName) . "&email=" . urlencode($Email) . "&phone=" . urlencode($Phone) . "&hs_context=" . urlencode($hs_context_json); //Leave this one be //replace the values in this URL with your portal ID and your form GUID $endpoint = 'https://forms.hubspot.com/uploads/form/v2/127851/b4574e7d-5f99-44a6-a1bc-654e503b0a9b'; $ch = @curl_init(); @curl_setopt($ch, CURLOPT_POST, true); @curl_setopt($ch, CURLOPT_POSTFIELDS, $str_post); @curl_setopt($ch, CURLOPT_URL, $endpoint); @curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/x-www-form-urlencoded' )); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = @curl_exec($ch); //Log the response from HubSpot as needed. $status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE); //Log the response status code @curl_close($ch); echo $status_code . " " . $response; ?>
0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Where to enter API in Joomla - code?

Are these feilds below being populated correctly?

$str_post = “firstname=” . urlencode($FirstName)
. “&lastname=” . urlencode($LastName)
. “&email=” . urlencode($Email)
. “&phone=” . urlencode($Phone)
. “&hs_context=” . urlencode($hs_context_json); //Leave this one be

if you were to echo $str_post does it come up right or are the values blank?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Where to enter API in Joomla - code?

@DaniMarketing Can you expand upon what you are trying to accomplish?

0 Upvotes