简体   繁体   English

从另一个域外部访问WordPress帖子

[英]Accessing WordPress posts externally from another domain

Is it possible to access & process WordPress posts of domain1.com by running a php script on domain2.com. 是否可以通过在domain2.com上运行php脚本来访问和处理domain1.com的WordPress帖子。 I want to access posts of domain1.com and store information like title, permalink, tag into a database on domain2.com 我想访问domain1.com的帖子,并将标题,永久链接,标签等信息存储到domain2.com上的数据库中

I do have admin access over domain1.com but for some reasons i want to access it thru domain2.com 我确实可以通过domain1.com进行管理员访问,但是由于某些原因,我想通过domain2.com进行访问

Any help to give me a starting point would be highly appreciated. 任何给我起点的帮助将不胜感激。

You can easily access your domain1.com posts from domain2.com very easily using either XML-RPC API or REST API . 您可以使用XML-RPC APIREST API轻松地从domain2.com轻松访问您的domain1.com帖子。 But REST API will be more convenient as you won't have to work with any XML parsing. 但是REST API将更加方便,因为您无需使用任何XML解析。 REST API is robust, easy and future-proof and it will give you JSON data which is pretty easy to work with. REST API健壮,容易且面向未来,它将为您提供易于使用的JSON数据。

Here is the REST API doc: http://v2.wp-api.org/ https://developer.wordpress.org/rest-api/ 这是REST API文档: http : //v2.wp-api.org/ https://developer.wordpress.org/rest-api/

And here is the XML-RPC if you are wondering: https://codex.wordpress.org/XML-RPC_WordPress_API 如果您想知道的话,这里是XML-RPC: https : //codex.wordpress.org/XML-RPC_WordPress_API

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

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