menu

Questions & Answers

Remote posting to wordpress via API (progrmatic posting / not from a wordpress site / php)

I'm trying to post programmatically to a WordPress site hosted on another server, running PHP. Most solutions use wp_remote_post() which is available within Wordpress environment. I couldn't find any example of how to create a new Wordpress post (set title, tags, category, tags and upload image), from a remote server. Maybe someone can provide a working example for all of these? Thanks,

I tried to curl to the site but without success, probably I did something wrong. I tried to install wordpress and require('wp-load.php') just to have the Wordpress environment on the remote server, but that still didn't work. I'm probably missing something fundamental here.

Comments:
2023-01-21 23:01:09
You can either talk to it using xmlrpc or REST. REST wise, packagist.org gives a fewhits - like github.com/varsitynewsnetwork/wordpress-rest-api-client Or for XMLRPC you could use this - github.com/letrunghieu/wordpress-xmlrpc-client (the tests/ folder has a few examples).
Answers(0) :