Fatal error: Call to undefined function get_header()

I got your point What you are trying to do. The solution to your problem is these lines of code to place above all the code of your index file or you may place it on all files of your theme.

<?php

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
    exit( 'Direct script access denied.' );
}
?>