Look now took from your poster on xmlrpc, add your custom field:
<? Xml version = "1.0"?> <MethodCall> <MethodName> metaWeblog.newPost </ methodName> <Params> <Param> <value> <array> <data> <Value> <int> 0 </ int> </ value> <Value> <string> admin </ string> </ value> <Value> <string> passwd </ string> </ value> <Value> <struct> <Member> <name> title </ name> <value> <string> hello world title2 </ string> </ value> </ member> <Member> <name> description </ name> <value> <string> hello world body2 </ string> </ value> </ member> <Member> <name> dateCreated </ name> <value> <dateTime.iso8601> 20200615T14: 18: 04 </dateTime.iso8601> </ value> </ member> <Member> <name> mt_allow_comments </ name> <value> <int> 0 </ int> </ value> </ member> <Member> <name> mt_allow_pings </ name> <value> <int> 0 </ int> </ value> </ member> <Member> <name> post_type </ name> <value> <string> post </ string> </ value> </ member> <Member> <name> custom_fields </ name> <value> <array> <data> <Value> <struct> <Member> <name> key </ name> <value> <string> thumbnail_external </ string> </ value> </ member> <Member> <name> value </ name> <value> <string> https: //my_site/image.jpg </ string> </ value> </ member> </ Struct> </ value> </ Data> </ array> </ value> </ member> </ Struct> </ value> <Value> <boolean> 1 </ boolean> </ value> </ Data> </ array> </ value> </ param> </ Params> </ methodCall>
It is formed as follows:
$ Date = new IXR_Date (time ()); $ PostData = [ 'Title' => 'hello world title2', 'Description' => 'hello world body2', 'DateCreated' => $ date, 'Mt_allow_comments' => 0, 'Mt_allow_pings' => 0, 'Post_type' => 'post', 'Custom_fields' => [ [ 'Key' => 'thumbnail_external', 'Value' => 'https: //my_site/image.jpg', ] ] ]; $ Client = new WP_HTTP_IXR_CLIENT ($ url); $ Client-> debug = false; if (! $ client-> query ( 'metaWeblog.newPost', array (0, $ login, $ passwd, $ postData, true))) { echo "err:". $ Client-> getErrorMessage (). "\ T"; return null; }
If you suddenly want to do so (not clear why), it is possible through the wp-cli more:
Если thumbnail_external это custom field, то надо слать их массивом. xml же не руками формируешь, надеюсь?
If thumbnail_external this custom field, it is necessary to send them to an array. xml not formiruesh hands, I hope?
Вы опять потоковый парсер json пишете?
Их в гугле полно https://github.com/salsify/jsonstreamingparser
Once again you're streaming parser json?
They are fully in Google https://github.com/salsify/jsonstreamingparser
https://console.online.net/en/order/server
Вот эту.
This one.
SeVlad, любой желающий может проверить самостоятельно и сделать выводы.
http://sprunge.us/WQVtfl