Contact Form 7
Use Contact Form 7 with cURL? (2 posts)

  1. puppyguitar
    Posted 4 years ago #


    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?

  2. noxion
    Posted 3 years ago #

    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');

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic