How can I remotely make a post to a user's blog after he/she gives me his login info using the wordpress api? What method do i need to use, what paremeters should it have, etc? Sample code will be great.
I'd prefer to use the XML-RPC api but others will also be acceptable.
WordPress already has multiple APIs, for things like plugins, settings, and shortcodes. These can be used by plugin and theme developers to interact with WordPress core and make things happen (like creating shortcodes and adding settings screens to the WordPress admin).
To post JSON to a REST API endpoint, you must send an HTTP POST request to the REST API server and provide JSON data in the body of the POST message. You also need to specify the data type in the body of the POST message using the Content-Type: application/json request header.
yeah you can use metaWeblog.newPost
or blogger.newPost
, an example of the first:
http://www.wprecipes.com/post-on-your-wordpress-blog-using-php
uses curl and xmlrpc_encode_request
an example of the second:
http://www.nickycakes.com/post-to-wordpress-remotely-with-xmlrpc-in-php/
yeah and @Francis is correct
I personally use the JSON API plugin. Create a post using:
http://www.example.com/api/create_post/?nonce=123456789&title=My%20Post&status=publish
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With