I would like to be write a script that can be used by people that have a variety of hosting providers. The script needs to be able to make a http-get (or post) request.
I have seen warnings in various places that php's, curl()
and fopen()
may not be enabled on some hosts. How common is it for these to be disabled? Are they available, e.g. in wordpress's hosting?
If they are frequently disabled, is there an alternative method for performing a http request from the server that is not?
Thanks in advance!
A wise way would be to stubbornly check all possible methods:
if(function_exists('curl_init'))
use curl
else if ini_get('allow_url_fopen')
use files
else if function_exists('fsockopen')
use sockets
else
echo 'hey, it's about time to change the hoster!'
Specifically to Wordpress, it heavily relies on server-to-server communication (think updates, pingbacks, Akismet etc), therefore most hosters do allow it.