How to add Request header in WordPress remote api calls

Hey am new to WP development, can any one tell me how to add request headers in wp_remote_get() or wp_remote_post() remote api calls. I tried the following but didnt work $response = wp_remote_get( add_query_arg( array( ‘Affiliate-Id’ => XXXXX, ‘Affiliate-Token’ => XXXXX ), $api_url ) , array( ‘timeout’ => 10)); 1 1 If you want to … Read more

using wp_remote_get instead of file_get_contents [duplicate]

This question already has answers here: rewrite script to use wp_remote_get instead of file_get_contents_curl (4 answers) Closed 8 years ago. have run my theme through the Theme checker plugin and it seems upset about use of file_get_contents to get a json url. I’ve found posts saying i should use wp_remote_get. I’m currently decoding the url … Read more