The title of this post says it all! I have been wracking my brain for weeks trying to get the latest recaptcha (v3) from Google to work on my PHP sites (no CMS) and I tried all these great tutorials and nothing worked. Google just never sent anything back.
I finally found a thread where one wonderful person posted this PSA that they needed to turn on allow_url_fopen in their php.ini file. I tried it and voila! Now all this code I thought was completely broken works perfectly. I simply has to pass on the great news! Hopefully this helps someone else.
allow_url_fopen = On