Quantcast
Channel: mysiteonline™ - Programming
Viewing all articles
Browse latest Browse all 15

Automatic Post Creation with Wordpress, PHP, and XML-RPC

$
0
0

So, for those of you who read my last blog post, you might notice that I was having issues with a script I wrote to create a new post in Wordpress when it came time to upgrade the Wordpress code.  The SQL internals were modified, and I was inserting directly in to the database (yes, I know, I broke a cardinal rule).  I needed an alternative way to insert information in to the database that would be much more future-proof.  I remembered about XML-RPC.

It took me some time to find answers to questions I had about XML-RPC and the Wordpress’ API.  Wordpress comes with the ability to use XML-RPC, and AtomPub.  With regards to XML-RPC, it supports a few protocols:

  1. MetaWeblog
  2. Movable Type
  3. Blogger
  4. Wordpress’ own methods

Since there was little written documentation as to how to do this, I thought I’d share my findings.  Also, although the Blogger API was very easy to figure out and use, I’m not going to cover it here mainly because it doesn’t support the creation of a title field – something for my purposes were required.  (To access the blogger API, I used this class.)  I’m also only going to cover what’s necessary to create a new post for my own means, nothing more – hopefully it’ll get you on your way to how you’d like to use it.



Note: The code examples - due to how this website displays single/double quotes, the code will not work if simply copy/paste is used. You'll need to replace the single/double quotes with standard ones, removing the curly, fanciful ones.


Continue reading "Automatic Post Creation with Wordpress, PHP, and XML-RPC"

Viewing all articles
Browse latest Browse all 15

Trending Articles