From ab40b2c5fb3ec71d1d7de6a90a21c7d98e4463fa Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Tue, 20 May 2025 22:59:32 +0200 Subject: [PATCH] =?UTF-8?q?Dodano=20wywo=C5=82anie=20webhooka=20w=20funkcj?= =?UTF-8?q?i=20saveContactData=20do=20przesy=C5=82ania=20danych=20kontakto?= =?UTF-8?q?wych?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/special-actions-middle.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/special-actions-middle.php b/plugins/special-actions-middle.php index 9554f2a..aeff4f2 100644 --- a/plugins/special-actions-middle.php +++ b/plugins/special-actions-middle.php @@ -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' ) )