سلام
یه اسکریپت php دارم که با استفاده از xmlrpc پست به وردپرس ارسال می کنه
اما وقتی از کاراکترهای فارسی استفاده می کنم اونا رو خراب ارسال می کنه
کسی راه حلی داره؟
---------- Post added at 03:13 PM ---------- Previous post was at 03:12 PM ----------
کد PHP:
if (wpPostXMLRPC("عنوان فارسی","مطلب فارسی",$rpcurl,$username, $password)) echo "Sent!"; else "Error Sending!";
function wpPostXMLRPC($title,$body,$rpcurl,$username,$password) {
$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>1, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post'
);
$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);
return $results;
}