send post include text and image by xmlrpc to wordpress
Im looking for a way to send remotely content(text and image ) by xmlrpc to wordpress but i couldn't find yet, im going to sent remotely content (text and image) over 100 post per 开发者_如何学JAVAminute to wordpress, whats the best way to do it? thanks so much
Use XMLRPC. Something like this:
$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$results = curl_exec($ch);
curl_close($ch);
精彩评论