复制Web钩子

EDITED AS I REALISED I HAD PASTED THE WRONG CODE Our previous website developer created the below code to post the entries of a Gravity Form submission from our website into our CRM

add_action( 'gform_after_submission_37', 'post_to_click_dimensions', 10, 2 );
function post_to_click_dimensions( $entry, $form ) {
$cd_visitorkey = '';
if(isset($_COOKIE["cuvid"])){
    $cd_visitorkey = $_COOKIE["cuvid"];
}

$post_url = 'http://analytics-au.clickdimensions.com/forms/h/aMvdWx4ZaEUCVF6HP8XR1o';
$body = array(
    'First Name' => rgar( $entry, '1' ), 
    'Last Name' => rgar( $entry, '2' ), 
    'Email' => rgar( $entry, '3' ),
    'Organisation Name' => rgar( $entry, '4' ),
    'Phone' => rgar( $entry, '17' ),
    'Postcode' => rgar( $entry, '13' ),
    'Contact' => rgar( $entry, '6' ),
    'LID' => rgar( $entry, '10' ),
    'ReferringPage' => rgar( $entry, '14' ),
    'I am interested in' => rgar( $entry, '16' ),
    'cd_visitorkey' => $cd_visitorkey
);

I would like to add the same functionality for a different form that uses slightly different fields but when I replicate the above code and insert into functions.php I get a syntax error. So I tweaked the code to the below which doesn't give a syntax error but doesn't post the fields to the CRM - ant idea how to make the two codes work together??

add_action( 'gform_after_submission_48', 'post_to_click_dimensions', 10, 2 );
function post_to_click_dimensions( $entry, $form ) {

$post_url = 'http://analytics-au.clickdimensions.com/forms/h/aKyxSmgLocUuqSn5iUMvsw';
$body = array(
    'First Name' => rgar( $entry, '2' ), 
    'Last Name' => rgar( $entry, '3' ), 
    'Email' => rgar( $entry, '4' ),
    'Phone' => rgar( $entry, '5' ),
    'Postcode' => rgar( $entry, '6' ),
                    'cd_visitorkey' => $cd_visitorkey
);

}

You mentioned that you need to do the same functionality for different form.

For that you need to mention the form Id inside the hook as mentioned below. In the current example it will work only for the ID=>48 gform. Place your form ID in place of 'formid' in the hook call.

add_action( 'gform_after_submission_formid', 'post_to_click_dimensions', 10, 2 );
function post_to_click_dimensions( $entry, $form ) {
        $cd_visitorkey = '';
        if(isset($_COOKIE["cuvid"])){
             $cd_visitorkey = $_COOKIE["cuvid"];
        }

$post_url = 'http://analytics-au.clickdimensions.com/forms/h/aKyxSmgLocUuqSn5iUMvsw';
$body = array(
    'First Name' => rgar( $entry, '2' ), 
    'Last Name' => rgar( $entry, '3' ), 
    'Email' => rgar( $entry, '4' ),
    'Phone' => rgar( $entry, '5' ),
    'Postcode' => rgar( $entry, '6' ),
    'cd_visitorkey' => $cd_visitorkey
);