Hi am new to WP development, I would like to add request headers to WordPress Rest API calls but don't know how, can anyone help me in this?
I tried following code but no luck
$args = array( 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( Fk-Affiliate-Id . ':' . YOUR_PASSWORD ) ) );
$api_url = 'http://ift.tt/1Q4a6KB';
global $affiliate;
$response = wp_remote_request( add_query_arg( array(
'Affiliate-Id' => $affiliate['aff-id'],
'Affiliate-Token' => $affiliate['aff-token']
), $api_url ) , array( 'timeout' => 10));
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire