SevenShores\Hubspot\Resources\Forms::submit PHP Method

submit() public method

Submit data to a form.
See also: http://developers.hubspot.com/docs/methods/forms/submit_form Send form submission data to HubSpot. Form submissions from external sources can be made to any registered HubSpot form. You can see a list of forms on your portal by going to the Contacts > Forms page
public submit ( integer $portal_id, string $form_guid, array $form ) : Response
$portal_id integer
$form_guid string
$form array
return SevenShores\Hubspot\Http\Response
    function submit($portal_id, $form_guid, $form)
    {
        $endpoint = "https://forms.hubspot.com/uploads/form/v2/{$portal_id}/{$form_guid}";
        $options['form_params'] = $form;
        return $this->client->request('post', $endpoint, $options, null, false);
    }

Usage Example

Example #1
0
 /** @test */
 public function submit()
 {
     $form = $this->createForm();
     $response = $this->forms->submit(62515, $form->guid, ['firstname' => 'FooBar']);
     $this->assertEquals(204, $response->getStatusCode());
 }