set headers correctly
parent
19f6416d19
commit
08850c5be4
|
@ -88,19 +88,16 @@ class ROEIntegration extends Export {
|
|||
function send () {
|
||||
$url = ROE_BASE_URL . "/api/publish";
|
||||
$content = json_encode($this->output);
|
||||
$headers = [
|
||||
$headers = join("\r\n", [
|
||||
"roe-key: " . get_site_option('roe_pressbooks_key'),
|
||||
"roe-secret: " . get_site_option('roe_pressbooks_secret'),
|
||||
"Content-Type: application/json"
|
||||
];
|
||||
// error_log(print_r($headers, true));
|
||||
|
||||
"Content-Type: application/json",
|
||||
]);
|
||||
$response = wp_remote_post($url, [
|
||||
"headers" => $headers,
|
||||
"body" => $content
|
||||
]);
|
||||
|
||||
// error_log(print_r($response, true));
|
||||
if ( is_wp_error($response) || $response['response']['code'] !== 200 ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: River of Ebooks for Pressbooks
|
||||
Plugin URI: https://pressbooks.org
|
||||
Plugin URI: https://github.com/villa7/roe-pressbooks
|
||||
Description: RoE integration with Pressbooks
|
||||
Version: 1.0.0
|
||||
Author: Pressbooks (Book Oven Inc.)
|
||||
Author URI: https://pressbooks.org
|
||||
Author: Free Ebook Foundation
|
||||
Author URI: https://ebookfoundation.org/
|
||||
Requires PHP: 7.0
|
||||
Pressbooks tested up to: 5.4.1
|
||||
Text Domain: roe-pressbooks
|
||||
|
@ -85,7 +85,7 @@ add_filter( 'pb_active_export_modules', function ( $modules ) {
|
|||
|
||||
add_filter( 'pb_export_formats', function ( $formats ) {
|
||||
if (\ROE\ROEIntegration::is_active()) {
|
||||
$formats['exotic']['roe'] = __( 'River of Ebooks', 'pressbooks' );
|
||||
$formats['exotic']['roe'] = __( 'Send to River of Ebooks', 'pressbooks' );
|
||||
}
|
||||
return $formats;
|
||||
} );
|
||||
|
@ -93,10 +93,3 @@ add_filter( 'pb_export_formats', function ( $formats ) {
|
|||
if (is_network_admin()) {
|
||||
new \ROE\Admin\ROEAdmin;
|
||||
}
|
||||
|
||||
add_action( 'http_api_debug', 'viper_http_api_debug', 10, 5 );
|
||||
function viper_http_api_debug( $response, $type, $class, $args, $url ) {
|
||||
error_log( 'Request URL: ' . var_export( $url, true ) );
|
||||
error_log( 'Request Args: ' . var_export( $args, true ) );
|
||||
error_log( 'Request Response : ' . var_export( $response, true ) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue