Created
May 13, 2014 02:14
-
-
Save localdisk/f4ffe0040a328522455d to your computer and use it in GitHub Desktop.
Backlog API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Backlog; | |
use GuzzleHttp\Client; | |
class XmlRpcSample | |
{ | |
protected $url; | |
protected $user; | |
protected $password; | |
public function __construct($url, $user, $password) | |
{ | |
$this->url = $url; | |
$this->user = $user; | |
$this->password = $password; | |
} | |
public function send($method, $params = []) | |
{ | |
$body = xmlrpc_encode_request($method, $params); | |
$response = (new Client)->post($this->url, [ | |
'body' => $body, | |
'auth' => [$this->user, $this->password] | |
]); | |
return $response->xml(); | |
} | |
} | |
require_once '../vendor/autoload.php'; | |
$api = new \Backlog\XmlRpcSample('https://demo.backlog.jp/XML-RPC', 'demo', 'demo'); | |
$res = $api->send('getProjects'); | |
var_dump($res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment