Skip to content

Instantly share code, notes, and snippets.

@wokamoto

wokamoto/gist:8838684

Last active Aug 29, 2015
Embed
What would you like to do?
[WordPress][Backlog API] WordPress から xmlrpc クライアントをしようして、backlog API を叩く
<?php
include_once( ABSPATH . WPINC . '/class-IXR.php' );
include_once( ABSPATH . WPINC . '/class-wp-http-ixr-client.php');
add_filter( 'http_request_args', function( $args, $url ) {
if ( false !== strpos($url, 'example.backlog.jp') ) {
$args['headers']['Authorization'] = 'Basic '. base64_encode('backlog_user' . ':' . 'backlog_passwd');
}
return $args;
}, 10, 2 );
$ixr_client = new WP_HTTP_IXR_Client( 'https://example.backlog.jp/XML-RPC' );
if ( !$ixr_client->query('backlog.getProjects') ) {
var_dump($ixr_client->getErrorCode());
}
print_r($ixr_client->getResponse());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.