In WordPress specifically (as opposed to vanilla PHP), there is a class available that uses WordPress' built-in HTTP request wrapper instead of relying on direct cURL calls. To use this wrapper, your code instead becomes: