Gmax hit it on the money, those two settings are usually always cut off server wide and you will not be able to enable them because they are HUGE security risks. Very easy for someone to do whatever they want on your website if you have them on, mainly allow_url_fopen. I can't stress enough how bad it is to think about cutting those on.
Take a look at the link for cURL that gmax posted. That should do what ya need there.
Also the foreach loop you use to gather the variables is just as dangerous. It is much better to get the specific variables you need in each php script when you need them, rather than take every variable available in the environment at execution. Check out
PHP: Using Register Globals - Manual for an explanation of how it can be exploited and why that method you are using now isn't a good idea.