How to get data from a form on a wordpress site?

WordPress Hooks Method

If the form is created with a plugin (like Contact Form 7 or Gravity Forms) you can use the available hooks:

CF7: wpcf7_before_send_mail

GF: gform_after_submission

This should cover the majority of WordPress Websites. On both hooks you can access the transmitted form fields and send them to your own script.

jQuery Method

If you simply want to access all possible forms and Plugins i only See the solution of writing a jQuery script that sends the data via AJAX but i would not recommend this approach as i think it could easily lead to conflicts.

$("#myform").submit(function(event) {
  // prevent form from sending
  event.preventDefault();

  // get the data
  var paramter1 = $("#a-field").val();

  $.ajax({
    url:   "url/to/your/script.php", 
    type:  "GET",
    data: {
        'parameter1' : paramter1
    },
    success: function(result){
      // data transmitted -> now send the original form
      $(this).unbind('submit').submit();
    }
  });
});

Reference:

  1. http://hookr.io/plugins/contact-form-7/4.7/hooks/#index=a
  2. https://docs.gravityforms.com/gform_after_submission/