you can simply use wp_remote_post:
$response = wp_remote_post( $url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => array( 'username' => 'bob', 'password' => '1234xyz' ),
'cookies' => array()
)
);
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
echo "Something went wrong: $error_message";
} else {
echo 'Response:<pre>';
print_r( $response );
echo '</pre>';
}
And after you receive the data and perform any required modifications, you can insert them into custom table using $wpdb:
global $wpdb;
$wpdb->insert(
'table',
array(
'column1' => 'value1',
'column2' => 123
),
array(
'%s',
'%d'
)
);
this will require creating a custom table, which can be created like that:
global $wpdb;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$custom_table = $wpdb->prefix . 'custom_table_name';
$sql = "CREATE TABLE IF NOT EXISTS $custom_table (
id mediumint(9) NOT NULL,
col1 varchar(50) NOT NULL,
col2 varchar(500) NOT NULL,
) $charset_collate;";
dbDelta($sql);
refer to wp_remote_post, $wpdb and wp_insert_post in WordPress documentation for more information