How to capture POST data with contact form7

This is how I used and its work for me to receive contact form 7 data after successe mail send and I used this data to send another server through API

add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' ); 
function your_wpcf7_mail_sent_function( $contact_form ) {
    $title = $contact_form->title;
    $submission = WPCF7_Submission::get_instance();  
    if ( $submission ) {
        $posted_data = $submission->get_posted_data();
    }       
   if ( 'Reagistation' == $title ) {
        $name = strtolower($posted_data['text-name']);
        $name = strtolower(str_replace(' ', '_',  $name));
        $email = strtolower($posted_data['email']);
        $phone = strtolower($posted_data['phone']);
        $Areyouarealtor = $posted_data['Areyouarealtor'];
        $ayor = strtolower($Areyouarealtor['0']);

 }
}

Try this :

add_action( 'wpcf7_sent', 'your_wpcf7_function' ); 

function your_wpcf7_function( $contact_form ) {
$title = $contact_form->title;
$submission = WPCF7_Submission::get_instance();

if ( $submission ) {
    $posted_data = $submission->get_posted_data();
}
   if ( 'MyContactForm' == $title ) {

    $firstName = $posted_data['first-name'];
    $lastName = $posted_data['last-name'];


   }
}

You need to access the $WPCF7_ContactForm object.

In your hooked function, you'd access the field you want like this:

yourFunction(&$WPCF7_ContactForm) {
    $text_area_contents = $WPCF7_ContactForm->posted_data['your-message'];
}