php - Can't access wordpress database with $wpdb

I have a website that runs Wordpress and I have just started studying php, because I need to retrieve some data from my database for certain purposes.
I'm trying to show the posts of the day in a list, with: 'post_title', 'post_name' and 'post_date' only if 'post_status' is 'publish'. I need to show it in a new page. This new page is loaded in the public_html.
I have tried to follow the rules of $wpdb, but I didn't get anything. Then, I have found that I need to require wp-load to have everything work fine.
The problem is this: when I try to require_once('wp-load.php'); I have a blank page. I tried to echo something before and after it to debug: before everything works, after anything.
The code is really simple:
<?php
echo "test1";
require_once('wp-load.php');
echo "test2";
?>
This is what I get:
test1пїЅпїЅ).HМіпїЅпїЅSпїЅ:6
My file and wp-load.php are on the same level.
Answer
Solution:
I have solved adding SHORTINIT before the statement:
define( 'SHORTINIT', true );
require('wp-load.php');
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: too few arguments to function laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.