• Resolved dreamfaction

    (@dreamfaction)


    I have set up my Gravity forms, on WP 4.0, Avada theme (all compatible) to submit users who want to register for a Citrix Webinar put on by my client fedinsider.com. I am currently in the testing phase of our new site which resides at fedinsidernews.com (private at this point), anyways I have been using the tech support for Gravity Forms and the API support team from Citrix, but we cannot seem to come to any result, and any help would be greatly appreciated.

    At first we had a php snippet as follows when not using your plugin, to allow the form to submit to a third party url string, the toughest part of this is we have a drop down menu field to list all of our events, which a user could then choose from and multi-select the webinars they wanted to sign up for. Hence creating one form for all our events (didn’t work):

    add_action( ‘gform_after_submission’, ‘post_to_third_party’, 10, 2 );
    function post_to_third_party( $entry, $form ) {

    $post_url = ‘https://goto.webcasts.com/viewer/regserver.jsp?ei=13&fname=1.3&lname=1.6&company=9&title=4&address1=6.1&address2=6.2&city=6.3&state=6.4&country=6.6&postalcode=6.5&phone=3&email=2&custom_question1=10&pass=citr003&tp_regconfemail=1’;

    $body = array(

    ‘fname’ => $entry[‘1.3’],
    ‘lname’ => $entry[‘1.6’],
    ‘company’ => $entry[‘9’],
    ‘title’ => $entry[‘4’],
    ‘address1’ => $entry[‘6.1’],
    ‘address2’ => $entry[‘6.2’],
    ‘city’ => $entry[‘6.3’],
    ‘state’ => $entry[‘6.4’],
    ‘country’ => $entry[‘6.6’],
    ‘postalcode’ => $entry[‘6.5’],
    ‘phone’ => $entry[‘3’],
    ’email’ => $entry[‘2’],
    ‘custom_question1′ => $entry[’10’],

    );

    // mutliselect field values are stored in a comma separated string so we split that into an array
    $webinars = explode( ‘,’, $entry[13] );

    // loop through the array of selected webinars
    foreach ( $webinars as $webinar ) {

    $body[‘ei’] = $webinar;

    GFCommon::log_debug( “post_to_third_party(): body => ” . print_r( $body, true ) );

    $request = new WP_Http();

    $response = $request->post( $post_url, array( ‘body’ => $body ) );
    GFCommon::log_debug( “post_to_third_party(): response => ” . print_r( $response, true ) );

    }

    However after reviewing you plugin, install instructions, and setting up your plugin per your notes, I set the following snippet yet (still doesn’t work) any help would be greatly appreciated. Thanks in advance:

    add_action(“ggah_submission_{ei}”, “your_function_hook_name_here_{ei}”, 10, 3);

    function your_function_hook_name_here_{ei} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{fname}”, “your_function_hook_name_here_{fname}”, 10, 3);

    function your_function_hook_name_here_{fname} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{lname}”, “your_function_hook_name_here_{lname}”, 10, 3);

    function your_function_hook_name_here_{lname} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{company}”, “your_function_hook_name_here_{company}”, 10, 3);

    function your_function_hook_name_here_{company} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{title}”, “your_function_hook_name_here_{title}”, 10, 3);

    function your_function_hook_name_here_{title} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{address1}”, “your_function_hook_name_here_{address1}”, 10, 3);

    function your_function_hook_name_here_{address1} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{address2}”, “your_function_hook_name_here_{address2}”, 10, 3);

    function your_function_hook_name_here_{address2} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{city}”, “your_function_hook_name_here_{city}”, 10, 3);

    function your_function_hook_name_here_{city} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{state}”, “your_function_hook_name_here_{state}”, 10, 3);

    function your_function_hook_name_here_{state} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{country}”, “your_function_hook_name_here_{country}”, 10, 3);

    function your_function_hook_name_here_{country} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{postalcode}”, “your_function_hook_name_here_{postalcode}”, 10, 3);

    function your_function_hook_name_here_{postalcode} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{phone}”, “your_function_hook_name_here_{phone}”, 10, 3);

    function your_function_hook_name_here_{phone} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{email}”, “your_function_hook_name_here_{email}”, 10, 3);

    function your_function_hook_name_here_{email} ($data, $form, $api)
    {
    $api_failed = false;

    add_action(“ggah_submission_{custom_question1}”, “your_function_hook_name_here_{custom_question1}”, 10, 3);

    function your_function_hook_name_here_{custom_question1} ($data, $form, $api)
    {
    $api_failed = false;

    // Send $data to API Here

    add_action( ‘gform_after_submission’, ‘post_to_third_party’, 10, 2 );
    function post_to_third_party( $entry, $form ) {

    $post_url = ‘https://goto.webcasts.com/viewer/regserver.jsp?ei=13&fname=1.3&lname=1.6&company=9&title=4&address1=6.1&address2=6.2&city=6.3&state=6.4&country=6.6&postalcode=6.5&phone=3&email=2&custom_question1=10&pass=citr003&tp_regconfemail=1’;

    $body = array(

    ‘fname’ => $entry[‘1.3’],
    ‘lname’ => $entry[‘1.6’],
    ‘company’ => $entry[‘9’],
    ‘title’ => $entry[‘4’],
    ‘address1’ => $entry[‘6.1’],
    ‘address2’ => $entry[‘6.2’],
    ‘city’ => $entry[‘6.3’],
    ‘state’ => $entry[‘6.4’],
    ‘country’ => $entry[‘6.6’],
    ‘postalcode’ => $entry[‘6.5’],
    ‘phone’ => $entry[‘3’],
    ’email’ => $entry[‘2’],
    ‘custom_question1′ => $entry[’10’],

    );

    // mutliselect field values are stored in a comma separated string so we split that into an array
    $webinars = explode( ‘,’, $entry[13] );

    // loop through the array of selected webinars
    foreach ( $webinars as $webinar ) {

    $body[‘ei’] = $webinar;

    GFCommon::log_debug( “post_to_third_party(): body => ” . print_r( $body, true ) );

    $request = new WP_Http();

    $response = $request->post( $post_url, array( ‘body’ => $body ) );
    GFCommon::log_debug( “post_to_third_party(): response => ” . print_r( $response, true ) );

    }

    // If Api Failed then set $api_failed = true;

    // This will send a Simple Email to the Admin to notify them of the error.
    if($api_failed)
    {
    if(function_exists(‘ggah_error_notification’))
    {
    $email = ‘tmorgan@dreamfaction.com’; // leave blank to use Admin Email
    $subject = ”; // leave blank to use Default
    $message = ”; // leave blank to use Default

    ggah_error_notification($email, $api, $subject, $message);
    }
    }
    }

    https://wordpress.org/plugins/gravitate-gforms-api-helper/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gravitate

    (@gravitate)

    Sorry if my documentation was not well defined, but you definitely are not using it correctly.

    You only need to specify the add_action once.
    So something to remember you need to create the Custom API Calls name in the Gravity form Settings then you must also go into each Gravity form field and set a Custom API Field Name of only the fields that you want sent to Citrix.

    From their all the fields and the Values will be sent to the add_action filter.

    Your code should be more like this:

    add_action("ggah_submission_citrix", "send_data_to_ctrix", 10, 3);
    function send_data_to_ctrix($data, $form, $api)
    {
      $api_failed = false;
    
        $post_url = 'https://goto.webcasts.com/viewer/regserver.jsp?ei=13&';
    
        $request = new WP_Http();
        $response = $request->post( $post_url, array( 'body' => $data ) );
    
      // If Api Failed then set $api_failed = true;
    
      // This will send a Simple Email to the Admin to notify them of the error.
      if($api_failed)
      {
        if(function_exists('ggah_error_notification'))
        {
          $email = '';  // leave blank to use Admin Email
          $subject = '';  // leave blank to use Default
          $message = '';  // leave blank to use Default
    
          ggah_error_notification($email, $api, $subject, $message);
        }
      }
    }

    Notice all the fields are sent to the function as $data.
    I am not familiar with WP_Http() so you will need to keep testing.

    If you get it working then please respond with how you fixed it.
    Thanks

    Thread Starter dreamfaction

    (@dreamfaction)

    contacted support they worked me through it. After days of work.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cannot send url to citrix api webinar host’ is closed to new replies.