I have create a file i.e mytestfile.php in root folder of wordpress blog.
Full path of mytestfile.php is http://www.example.com/blog/mytestfile.php.
Now, I want to access all global variables, functions like $wp_query, query_posts.
As you have created mytestfile.php in blog root folder.
Just add the following line in top. This will load wordpress blog and you can access global variables.
require( 'wp-load.php' ); global $wp_query;Now, you can access $wp_query, query_posts.