Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

contact form 7 I want to run php code after submitting ? is it possible?

contact form 7 I want to run php code after submitting ? is it possible ?
I have php curl code I want to run it but I don’t know how to do it.

my php code :


<?php


$data = array(
    'chatId' => '9011111@c.us',
    'mentions' => array(
        '9011111@c.us'
    ),
    'text' => 'Hi there!',
    'session' => 'default'
);


$options = array(
    'http' => array(
        'method' => 'POST',
        'header' => "Content-type: application/json\r\n",
        'content' => json_encode($data)
    )
);


$context = stream_context_create($options);
$result = file_get_contents('http://1.1.1.1:3000/api/sendText', false, $context);


echo $result;
?>

Is it possible how to do it?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

yes, it is possible. you’ll need to use a WordPress hook wpcf7_mail_sent to do it. You need to wrap your cURL code into a funtion and then use the hook as follow:

add_action('wpcf7_mail_sent', 'your_function');
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading