redbranchmedia

Post from Gravity Form to external Form

Jan 16th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <?php
  2. // for demo form
  3. add_action('gform_after_submission_3', 'custom_function_name', 10, 2); //change number in gform line to match form number
  4. function custom_function_name($entry, $form) {
  5.  
  6.     $post_url = 'https://exampleform.com/id/456789'; //the public url for the form
  7.     $body = array( //the first part is the field name of the input on the form
  8. //the second is the gravity forms field name
  9.         'field_51633323' => $entry['1.3'], //first name
  10.         'field_51633324' => $entry['1.6'], //last name
  11.         'field_51633325' => $entry['2'], //company
  12.         'field_51633326' => $entry['3'], //email
  13.         'field_51633327' => $entry['4'], //phone
  14.         'field_51633328' => $entry['5'] //comment box
  15.         );
  16.    
  17.     $request = new WP_Http();
  18.     $response = $request->post($post_url, array('body' => $body));
  19.    
  20. }
  21.  
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment