Dodano wywołanie webhooka w funkcji saveContactData do przesyłania danych kontaktowych

This commit is contained in:
2025-05-20 22:59:32 +02:00
parent 3be85fa3d1
commit ab40b2c5fb

View File

@@ -38,6 +38,17 @@ function saveContactData($name, $email, $address, $zip, $phone, $cooperation, $m
fputcsv($csvContent, $row);
}
fclose($csvContent);
// call webhook http://projectpro.dynu.net:5678/webhook-test/744ec5ad-9e7d-4a97-8391-d172c6c02eff
$webhookUrl = 'http://projectpro.dynu.net:5678/webhook/744ec5ad-9e7d-4a97-8391-d172c6c02eff';
$data = json_encode( $contactData );
$ch = curl_init( $webhookUrl );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
$response = curl_exec( $ch);
curl_close( $ch );
}
if ( \S::get( 'action' ) == 'footer_contact_mail_send' and \S::get( 'token' ) == \S::get_session( 'form-token' ) and !\S::get( 'website' ) )