01.
function
qpost(
$u
,
$t
,
$p
){
02.
$wurl
=
$u
;
03.
$template
=
$t
;
04.
$pd
=
$p
;
05.
$cate
=
"test"
;
06.
$user
=
"test"
;
07.
$pass
=
"123456"
;
08.
09.
$content9
=
array
(
10.
'title'
=>
$pd
,
11.
'description'
=>
$template
,
12.
'mt_allow_comments'
=>0,
13.
'mt_allow_pings'
=>0,
14.
'post_type'
=>
'post'
,
15.
'categories'
=>
array
(
$cate
),
16.
);
17.
$wp_url
=
'http://'
.
$wurl
.
'/xmlrpc.php'
;
18.
$client
=
new
IXR_Client(
$wp_url
);
19.
$params
=
array
(0,
$user
,
$pass
,
$content9
,true);
20.
21.
if
(!
$client
->query(
'metaWeblog.newPost'
,
$params
)) {
22.
23.
die
(
'Something went wrong - '
.
$client
->getErrorCode().
' : '
.
$client
->getErrorMessage());
24.
25.
}
else
{
26.
$response
=
$client
->getResponse();
27.
}
28.
return
$response
;
29.
}