Use the Authorization
header. Example:
$auth = base64_encode( $username . ':' . $password );
$args = [
'headers' => [
'Authorization' => "Basic $auth"
],
'body' => $body,
];
$response = wp_remote_post( $url, $args );
$response_body = wp_remote_retrieve_body( $response );
Related Posts:
- How to remove rest api link: in http headers?
- HTTP request on localhost failing
- Setting Last Modified HTTP Header on static Home Page
- If Modified Since HTTP Header
- Remove rel=shortlink from HTTP header
- Change the headers content type with wp_remote_post
- HTTP Header on specific page is application instead of text
- Authenticate a user for current request
- WordPress 502 | Header Upstream send too big
- What is this HTTP_REFERRER “WordPress/4.1.2”
- Enable CORS for getting an inline SVG by URL
- Why is http header providing 404 while site is online?
- How do you modify HTTP response headers on feed/?
- How to define the basic HTTP authentication using cURL correctly?
- How to define the basic HTTP authentication using cURL correctly?
- How to do a PUT request with cURL?
- PHP + curl, HTTP POST sample code?
- Can PHP cURL retrieve response headers AND body in a single request?
- Setting Curl’s Timeout in PHP
- Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?
- How to use OAuth authentication with REST API via CURL commands?
- How does one suppress a 404 status code in a WordPress page?
- Admin bar and fixed header issue?
- disable wordpress canonical tag meta
- Disable h1 and h2 from rich text editor combobox
- Recommended location to set response headers?
- Is it safe to fix Access-Control-Allow-Origin (CORS origin) errors with a php header directive?
- Custom endpoint and X-WP-TotalPages (headers)
- Clarity needed on usage of multiple 403 forbidden header() functions at the beginning of the plugin files
- Log in from one wordpress website to another wordpress website
- Getting “Cannot modify header information – headers already sent” error on wp-admin only whenever any plugin is activated
- Additional Option on Custom Header admin
- Programmatically log in a wordpress user
- Putting content into header.php without using wp_head
- How can I change HTTP headers only to posts of a specific category from a plugin
- Image slider to display at the very top of home page
- Is curl required?
- Getting redirect to happen before header output
- How do you log a user out with wp_logout?
- Indenting (tabbing) WP_head
- Different custom header image on different page
- Retrieving Google Plus share count with wp_remote_post
- Disabling the X-Redirect-By response header
- Why I can’t add a script-code into theme-settings without 403-forbidden?
- Auto-refresh page every minute?
- Is it wrong to put header tags inside WordPress help tabs? [closed]
- On Plugin Activation, How Do I Check for Proper Transport Mechanism?
- Remove link around logo
- Want to make header and footer CMS driven sothat Editors can modify its content from wordpress admin section
- Facebook embeds loading the wrong language
- Header: Include Date Published and Date Modified
- Page source contains an http item that makes page insecure; but in php files it’s written as https!
- Cleanup Body_Class
- Banner in WordPress
- cURL RETURNTRANSFER function in wp_remote_post
- Google Tag Manger – no-script Code Not Found
- Determine what pages are in my header [closed]
- How to convert this cURL to wp_remote_*?
- How to remove main domain header title from after sub domain header title
- I want to hide header in the static homepage that I am working on [closed]
- Remove all WordPress HTTP headers (not in-source embeds)
- How to send file by wp_remote_post?
- Creating dynamic header and footer files
- Strange 403 header response
- 404 or ugly page on IE, but Firefox, Chrome looks perfect
- Changing header text from uppercase to normal [closed]
- Safe to start a php session on get_header action?
- My header not showing up [closed]
- How to Access Script Tags in Header
- H1 tags for header image?
- Where are my js and css links in header?
- Why does WordPress allow inserting tags into posts?
- Is there a way to get minimal WordPress functions for iframed content?
- Problems accessing stylesheets/scripts loaded in WP header
- Rotate images in header based on date
- Why does WP load so many files in the head of source code? How do I optimize it?
- Trying to set a cookie based on $_POST parameter
- 404/500 error on content images if Referer header is from another domain [closed]
- How to add some lines to the wp-login.php header via functions.php?
- How to Customize Wp Default Title and a prefix
- Hook to change HTTP response headers
- allowed_http_origins() only works in theme functions.php
- How to send a HTTP Post request using PHP Curl and WordPress
- Last-Modified header support doesnât speed up server processing – want more
- Insert stylesheet into WordPress header?
- Why are tags from the header showing up on my WordPress site? [closed]
- How to register and set http/2 server prefetch for a specific asset?
- Header with content
- WordPress Template not getting my Sub-Header File
- How to add social follow button to header? [closed]
- Include two headers
- Empty header tags [closed]
- Insert Facebook button into header [closed]
- Empty lines in header, how to remove them
- Benefits to using CSS for header image instead of html img tag [closed]
- Export Header and Footer
- Custom headers in WordPress, are there also custom footers?
- Point get_header() to different plugin
- How do I begin debugging where the description meta tag is set for my categories?
- How do I get the Social Media Plugin to show up in my Twenty Eleven child theme’s header?