forked from wechatsync/Wechatsync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
33 lines (24 loc) · 824 Bytes
/
test.php
File metadata and controls
33 lines (24 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once('IXR_Library.php');
$client = new IXR_Client('http://localhost:8082/xmlrpc.php');
$username = 'test';
$password = '123456';
$blogId = 0;
// 测试获取用户博客信息
$queryBlog = $client->query('wp.getUsersBlogs', array($username, $password));
if (!$queryBlog) {
die('An error occurred - '.$client->getErrorCode().":".$client->getErrorMessage());
}
print_r($client->getResponse());
// 测试文件上传
$localFile = file_get_contents('./test.png');
$callResult = $client->query('wp.uploadFile', array($blogId, $username, $password, array(
'name' => 'save.png',
'type' => 'image/png',
'bits' => $localFile
)));
if (!$callResult) {
die('An error occurred - '.$client->getErrorCode().":".$client->getErrorMessage());
}
// print_r($client);
print_r($client->getResponse());