Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created August 1, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/b0050a06f124f9884b22426b1bd51989 to your computer and use it in GitHub Desktop.
Save tommcfarlin/b0050a06f124f9884b22426b1bd51989 to your computer and use it in GitHub Desktop.
[WordPress] Sending Authorization Headers with WordPress
<?php
$response = wp_safe_remote_post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => $token
],
'body' => wp_json_encode($args),
'method' => 'POST',
'data_format' => 'body',
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment