APIs & Integrations

newMember
参加者

Get hubspot form in my php page

Hii,

   I need to have a form in my php page and this form is created in the hubspot. I have seen two options like embed the code (where we use a script and place this script below the html) and share link (where we will use this link for the form). I had tried with embed code and the form got displayed in the frontend. I think we need to do custom styling.

   My question is, is it possible to render the form by some api calls directly?? I had tried with " https://api.hubapi.com/forms/v2/forms/1eae3941-9ce8-411d-8b91-87a92c0c9d5c/?hapikey=demo" . But it is returning json output and not the form display.

  Whether it will be possble to render the form as we get with embed code method, by calling an api???

 

Can someone help please??

0 いいね!
2件の返信
IsaacTakushi
HubSpot Employee
HubSpot Employee

Get hubspot form in my php page

Hi, @newMember.

 

Thanks for reaching out.

 

It is not possible to retrieve a HubSpot form's HTML source code directly via an API request. The endpoint you used is the closest you can get.

Using the JSON returned, you could reconstruct an HTML form with either PHP or JavaScript from the form's fields and then send the submission to this endpoint.

Alternatively, it might be simpler to just create a custom HTML form which has the same fields as the HubSpot form and use this endpoint to send the submissions to the HubSpot form.

Isaac Takushi

Associate Certification Manager
newMember
参加者

Get hubspot form in my php page

Hi @IsaacTakushi 

   Thank you. Very clearly explained.

Mine is a multilanguage site and the changes done to the hubspot form must reflect into my website form. This is what my requirement is.

So which will be the better way to accomplish this?

  a) Using embed script code. So for each language we create translation of the form and use the respective forms in each language

   or

  b) using the api and build the form from php. 

 

And one more thing,

  If it is a multilanguage site, is there any other options available other than creating separate forms in each language??

 

Thank you in advance

0 いいね!