Live and learn. I didn’t realize that when a cron job runs, it does not load the site php.ini file, but by adding a custom directive, we can tell the the php cron job to load the file. The error I was receiving is below even though I had allow_url_fopen enabled:
Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/username/script.php on line 12
Adding the custom directive resolved the issue and hopefully will for you too.