I am pulling some data from an external API using the following code on my wordpress site.
function GetEventFromApi($username,$password,$url)
{
$headers = array(
'headers' => array(
'Authorization' => 'Basic ' . base64_encode("$username:$password"),
'Content-Type' => 'application/json',
),
);
$response = wp_remote_get($url, $headers);
$body = wp_remote_retrieve_body($response);
print_r($response);
print_r("////////////Get Event From Api END///////////");
$decodeBody = json_decode($body, true);
return $decodeBody;
}
I have a server that runs this code without any problems and has been live for a long time. When I try to upload my wordpress theme to another server, I get the following error.
WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => cURL error 56: GnuTLS recv error (-110): The TLS connection was non-properly terminated. ) ) [error_data] => Array ( ) [additional_data:protected] => Array ( ) )