Working with the remote API requests with WordPress. I have used wp_remote_post()
function to request the HTTP data but I am unable to update the headers Content-type
I am using the following code
wp_remote_post( $url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array("Content-type" => "application/x-www-form-urlencoded;charset=UTF-8"),
'body' => array( 'username' => 'bob', 'password' => '1234xyz' ),
'cookies' => array()
)
);
But when I print the response content-type is still text/html
but the server require urlencoded
content-type.
How i can update the headers content type?