| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/aurointeriors/public_html/wp-content/plugins/metform/core/integrations/ |
Upload File : |
<?php
namespace MetForm\Core\Integrations;
defined( 'ABSPATH' ) || exit;
class Slack {
public function call_webhook( $form_data, $settings ){
$msg = [];
$data = [
"text" => "New form submitted.",
"pretext" => "from slack Webhook",
"color" => "#36a64f",
"fields" => [
[
"title" => "First Name",
"value" => isset($form_data["mf-listing-fname"]) ? $form_data["mf-listing-fname"] : '',
],
[
"title" => "Last Name",
"value" => isset($form_data["mf-listing-lname"]) ? $form_data["mf-listing-lname"] : '',
],
[
"title" => "Email",
"value" => isset($form_data[$settings['email_name']]) ? $form_data[$settings['email_name']] : '',
],
],
];
$status = wp_remote_post( $settings['url'], array(
'method' => 'POST',
'timeout' => 30,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => json_encode($data),
'cookies' => array()
)
);
if(is_wp_error($status)){
$msg['status'] = 0;
$msg['msg'] = "Something went wrong : ".$status->get_error_message();
}else{
$msg['status'] = 1;
$msg['msg'] = esc_html__('Your data inserted on slack.', 'metform');
}
return $msg;
}
}