@@ -79,13 +79,14 @@ public static function _get( $url, $api_key = null ) {
7979 curl_setopt ( $ ch , CURLOPT_FAILONERROR , 0 );
8080 curl_setopt ( $ ch , CURLOPT_TIMEOUT , self ::TIMEOUT );
8181 curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false );
82+ curl_setopt ( $ ch , CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
83+
84+ // Setup headers
85+ $ headers = array ( 'Accept: application/json ' );
8286 if ( ! is_null ( $ api_key ) ) {
83- curl_setopt (
84- $ ch , CURLOPT_HTTPHEADER , array (
85- self ::AUTH_HEADER . ': ' . $ api_key
86- )
87- );
87+ array_push ( $ headers , self ::AUTH_HEADER . ': ' . $ api_key );
8888 }
89+ curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers );
8990
9091 $ response = curl_exec ( $ ch );
9192 curl_close ( $ ch );
@@ -127,13 +128,15 @@ public static function _post( $url, $data, $files = array(), $api_key = null ) {
127128 curl_setopt ( $ ch , CURLOPT_FAILONERROR , 0 );
128129 curl_setopt ( $ ch , CURLOPT_TIMEOUT , self ::TIMEOUT );
129130 curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false );
131+ curl_setopt ( $ ch , CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
132+
133+ // Setup headers
134+ $ headers = array ( 'Accept: application/json ' );
130135 if ( ! is_null ( $ api_key ) ) {
131- curl_setopt (
132- $ ch , CURLOPT_HTTPHEADER , array (
133- self ::AUTH_HEADER . ': ' . $ api_key
134- )
135- );
136+ array_push ( $ headers , self ::AUTH_HEADER . ': ' . $ api_key );
136137 }
138+ curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers );
139+
137140 $ response = curl_exec ( $ ch );
138141 if ( false === $ response ) {
139142 $ curl_error = curl_error ( $ ch );
0 commit comments