简体   繁体   English

如何使用其REST API在另一个wordpress网站中创建wordpress发布?

[英]How can I create a wordpress post in another wordpress site using their REST API?

I want to create and update a wordpress post from one site which would automatically post to another wordpress site. 我想从一个站点创建并更新一个wordpress帖子,该站点将自动发布到另一个wordpress站点。 I've tried playing around with the REST API in wordpres 4.7+ but I keep getting the following message 我尝试在Wordpres 4.7+中使用REST API,但我不断收到以下消息

{"code":"rest_cannot_create","message":"Sorry, you are not allowed to create posts as this user.","data":{"status":401}}

Any thoughts on how I can tackle this? 关于如何解决这个问题有什么想法吗?

Thanks 谢谢

I can create a post from localhost into live wordpress blog with basic authentication. 我可以使用基本身份验证将本地主机中的帖子发布到实时wordpress博客中。 So I think you can post remotely a wordpress blog from another wordpress website. 因此,我认为您可以从另一个wordpress网站远程发布wordpress博客。 I use php file_get_contents and cURL , both are working. 我使用php file_get_contents和cURL,两者都正常工作。 You may try this method bellow http://www.wpsaga.info/wp-rest-api-create-post-with-php-curl/ 您可以在下面的方法中尝试此方法http://www.wpsaga.info/wp-rest-api-create-post-with-php-curl/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM