• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

wp_remote_get() not passing authentication

phpwordpresshttp


PHP Snippet 1:

$wp_request_headers = array(
    'Authorization' => 'Basic ' . base64_encode( 'username:password' )
);

$wp_request_url = 'http://localserver/wordpress-api/wp-json/wp/v2/posts/52';

$wp_delete_post_response = wp_remote_request(
    $wp_request_url,
    array(
        'method'    => 'DELETE',
        'headers'   => $wp_request_headers
    )
);

echo wp_remote_retrieve_response_code( $wp_delete_post_response ) . ' ' . wp_remote_retrieve_response_message( $wp_delete_post_response );

Related Snippets

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

Add rows to Single product Additional information table in WooCommerce 3.6

getting error while enter Command => php artisan route:list

How to show a popup modal in codeIgniter?

Get data from accuweather api url

How can I make good efficent AJAX live forms with just jQuery and

How to retrieve Active Directory group policy maximum password age using LDAP

Laravel lang slug in url

Sagepay Error The Vendor failed to provide a RedirectionURL

add " ? " in url via htaccess RewriteRule

Don't show recurring price for WooCommerce subscriptions worth 0$

How to convert time from one timezone to another in PHP

How to install php_imagick on wamp64

In PHP, which is faster: preg_split or explode?

I'm trying to write a clean url for my website using the $_SERVER['REQUEST_URI'] in php

About Contact Privacy policy Terms and conditions