<?php
// Plugin Name: Get Remote First Bytes

function get_remote_first_bytes( $url ) {
	if ( ! function_exists( 'wp_tempnam' ) ) {
		require_once( ABSPATH . 'wp-admin/includes/file.php' );
	}

	// @see download_url()
	$file = wp_tempnam( $url );

	$response = wp_remote_get( $url, array(
		'stream'              => true,
		'filename'            => $file,
		'limit_response_size' => 32768, // 32 KB
	) );

	echo size_format( filesize( $file ) );
	
	unlink( $file );
}

$url = 'https://archive.org/download/corblund2013-03-14.matrix.flac/corblund2013-03-14track09.mp3';
get_remote_first_bytes( $url );
