For a plugin that communicates with somewhere else, I hear we’re supposed to use wp_remote_post and wp_remote_get instead of PHP’s Curl library.
Okay, but is there a fast and proper way on plugin execution to test for a blog’s PHP/host OS to have the proper transport mechanism installed? I mean, I could attempt a test POST, but thought WP might have a better, faster mechanism that I can test for? Doing the following is unacceptable:
if (!function_exists('curl_exec')) {
wp_die('The CURL API is not installed with PHP. You cannot use this plugin without that. Ask your web hosting provider to install it.');
}
I wouldn’t cause the plugin to die like that. Just check for cURL each time you need to make a call or fall back on
wp_remote_(post|get)
(eg. write a wrapper function that takes care of the check and send the data/headers you want).BUT, if you really really want to disable the plugin if cURL is not installed, you can use an activation hook to check for the
curl_exec
function and deactivate the plugin if not.For what it’s worth, I believe that the HTTP api tries to use cURL if it’s available.