简体   繁体   中英

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. I want to access posts of domain1.com and store information like title, permalink, tag into a database on domain2.com

I do have admin access over domain1.com but for some reasons i want to access it thru 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 . But REST API will be more convenient as you won't have to work with any XML parsing. REST API is robust, easy and future-proof and it will give you JSON data which is pretty easy to work with.

Here is the REST API doc: 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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