PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Vertical Response - got a cURL set-up working with a GF hook

  1. red

    Wasn't able to post to the existing Vertical Response post, so opened a new one. This isn't a plugin add-on, so not super elegant and requires a little more sleuthing in your own set-up, but is working for us using cURL.

    I used the cURL part of this solution about a year ago, inspired by this information:

    To integrate that into a Gravity Form, wrote a function that can be added to the theme functions.php file and used by the GF post submission hook:

    Things you need to know to make this work:
    * Your Vertical Response form id
    * Gravity Form field ids (findable in the blue title bar of each field when editing your form)

    Add this function to your theme's functions.php file:

    * You don't have to send all of the gf fields to VR, just put the ones you want in the $postFields
    * The gravity form (gf) fields that you're wanting to post to VR need to match up to fields in a VR opt-in form
    * Just because you have xyz field in your VR general field list doesn't mean it will take it from your gf. The VR opt-in form has to have the fields you want to post to in it or it will cause an invalid form error from VR
    * If it's successfully posting with cURL but not showing up in VR (check the $response form output and post - might be an invalid form error)- you may need to make a new opt-in form instead of using an existing one
    * The gf field ids need to be in quotes when defined if you reference something like a checkbox: $gf_field_id_optin = '11.1';

    If you work out an improvment to this or have a better approach, please share!


    Posted 9 years ago on Friday September 28, 2012 | Permalink
  2. Thank you for this post.

    Posted 9 years ago on Friday September 28, 2012 | Permalink
  3. Thanks also from me! I'm using this now and it works a treat.

    Does anyone know how we could grab the gform fields by name (rather than hardcoding IDs from a particular form) so that this same function could be used across many different forms?

    Posted 9 years ago on Wednesday October 10, 2012 | Permalink
  4. I don't see any contact information on red's public profile page, so I will leave this open in case anyone has any suggestions for extending the custom functionality to make it more generic.

    Posted 9 years ago on Wednesday October 10, 2012 | Permalink
  5. red

    You can access the form data with the array $form, and the fields specifically with $form['fields'].

    Then you could do a loop through each field and look for type=email.

    Here is the output of just $form['fields'][8] which is the email field in a form I'm using.

    adminLabel =>
    adminOnly =>
    allowsPrepopulate =>
    defaultValue =>
    description =>
    content =>
    cssClass => gf_left_half
    errorMessage =>
    id => 9
    inputName =>
    isRequired => 1
    label => Email
    noDuplicates =>
    size => medium
    type => email
    postCustomFieldName =>
    displayAllCategories =>
    displayCaption =>
    displayDescription =>
    displayTitle =>
    inputType =>
    rangeMin =>
    rangeMax =>
    calendarIconType =>
    calendarIconUrl =>
    dateType =>
    dateFormat =>
    phoneFormat =>
    addressType =>
    defaultCountry =>
    defaultProvince =>
    defaultState =>
    hideAddress2 =>
    hideCountry =>
    hideState =>
    inputs =>
    nameFormat =>
    allowedExtensions =>
    captchaType =>
    page_number =>
    captchaTheme =>
    simpleCaptchaSize =>
    simpleCaptchaFontColor =>
    simpleCaptchaBackgroundColor =>
    failed_validation =>
    productField =>
    enablePasswordInput =>
    maxLength =>
    enablePrice =>
    basePrice =>
    calculationFormula =>
    calculationRounding =>
    enableCalculation =>
    disableQuantity =>
    inputMask =>
    inputMaskValue =>
    formId => 3
    pageNumber => 1
    descriptionPlacement => below
    validation_message =>
    adminLabel =>
    adminOnly =>
    allowsPrepopulate =>
    defaultValue =>
    description =>
    content =>
    cssClass => gf_right_half
    errorMessage =>

    So maybe something like:

            foreach($form['fields'] as $key=>$fieldinfo){
                foreach($fieldinfo as $key2=>$fielddata){
                    if($key2=='type' && $fielddata=='email'){
                        $gf_field_id_email = $fieldinfo['id'];

    and then you can access the entry data (email address) with this:

    Hope this helps!

    Posted 9 years ago on Thursday November 1, 2012 | Permalink
  6. is there ever going to be a plug in for this.. I didn't get gravity form to code.. it's simple to use that is what makes it great.. please don't take the greatness away..

    Posted 8 years ago on Friday June 14, 2013 | Permalink
  7. David Peralty

    We aren't taking any greatness away, but we can't do every add-on for every service. We just don't have the resource to release them at a quality level we would be happy with. The community has access to everything they need to make add-ons, and there are over 50 already on the WordPress Plugins Extend.

    Posted 8 years ago on Friday June 14, 2013 | Permalink