add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 ); function post_to_third_party( $entry, $form ) { $curl = curl_init(); $tkt = rgar( $entry, "2"); $email = rgar( $entry, "8"); $cmt = rgar( $entry, "5"); $con = rgar( $entry, "7"); $rsp = rgar( $entry, "1"); curl_setopt_array($curl, array( CURLOPT_URL => "https://connect.mytechexperts.com/v4_6_release/apis/3.0/service/surveys/9/results", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\r\n \"ticketId\": $tkt,\r\n \"emailAddress\": \"$email\",\r\n \"footerResponse\": \"$cmt\",\r\n \"contactMeFlag\": false ,\r\n \"contact\": {\r\n \"id\": $con,\r\n \"name\": \"string\", \r\n \"_info\": {}\r\n },\r\n \"results\": [\r\n {\r\n \"questionId\": 46,\r\n \"answer\": $rsp\r \n }\r\n ],\r\n \"surveyId\": 0,\r\n \"_info\": {}\r\n}", CURLOPT_HTTPHEADER => array( "authorization: Basic dGVjaGV4cGVydHMrZGJua3RRT3RON1NCYWpsZzo1amhpdDdCWmdqckhnMjlZ", "cache-control: no-cache", "content-type: application/json", "postman-token: ca098b0a-b1e1-1aee-d734-b7c0afb4e9e5" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } } http://www.mytechexperts.com/csat/?Rating=0&Ticket=109152&ContactID=192&EmailAddress=tfox@mytechexperts.com