Support » Plugin: Contact Form 7 » Use Contact Form 7 with cURL?

  • puppyguitar



    I’m using the Contact Form 7 plugin on my site, and in addition to its normal behavior of sending an email when the form is submitted, I would also like to post the form data to a second, remote URL using cURL. Could anyone suggest the best way to implement this?

Viewing 1 replies (of 1 total)
  • In your functions.php insert this:

    function leads_integration_wp_cf7( $cf7 ) {
           $url = your_url_goes_here;
           $postparams = your_post_params_goes_here;
           $ch = curl_init($url);
           curl_setopt($ch, CURLOPT_POSTFIELDS, $postparams);
           curl_setopt($ch, CURLOPT_POST, 1);
           curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1 );
           curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
           $output = curl_exec($ch);
    add_action('wpcf7_mail_sent', 'leads_integration_wp_cf7');
Viewing 1 replies (of 1 total)
  • The topic ‘Use Contact Form 7 with cURL?’ is closed to new replies.