PHP code for displaying WordPress posts in a static page not working

I figured out that the problem was with executing the simplexml_load_file, and it simply required going to my php.ini file and setting allow_url_fopen flag from off to on. The code now executes flawlessly and the output is as intended.

error code: 523