b4swine has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I am trying to use WordPress::XMLRPC to post to a blog. It appears to be very easy to do, and my code is:
use strict; use warnings; use WordPress::XMLRPC; my $wp = WordPress::XMLRPC->new({ username => '...', password => '...', proxy => 'http://.../blog/xmlrpc.php', }); $wp->server or die; my $xx = $wp->getCategories(); print STDERR $wp->errstr if $wp->errstr; use Data::Dumper; die Dumper( $wp );
When I run it, it says
# WordPress::XMLRPC::getCategories() - ERROR faultString, Bad login/pa +ss combination. # WordPress::XMLRPC::getCategories() - ERROR faultCode, 403 $VAR1 = bless( { 'errstr' => '# WordPress::XMLRPC::getCategories() - E +RROR faultString, Bad login/pass combination. # WordPress::XMLRPC::getCategories() - ERROR faultCode, 403 ', 'password' => '...', 'blog_id' => 1, 'server' => bless( { ...and a lot more...
I have checked very carefully. I can log in with the username password to the website. The xmlrpc.php file is located in the blog directory. When I enter the url to xmlrpc.php, in a browser, I get "XML-RPC server accepts POST requests only." (which indicates that the url is correct). I entered the same server, username and password to "Windows Live Writer", just to check (because that must also use XMLRPC calls) and that had no problems logging in to the site. So why does this code say "bad login/pass combination"?

Replies are listed 'Best First'.
Re: Wordpress::XMLrpc problem
by Anonymous Monk on Mar 24, 2010 at 17:22 UTC
    Um, because you gave it wrong login/pass combination? Try turning on DEBUGging for extra detail
    $WordPress::XMLRPC::DEBUG = 1;

      That is a pretty lame comment. I have been working at this for more than a day. I mentioned that I have tried the username and password and have logged on successfully, using a browser. I used cut and paste, just to make sure that there was no spelling error. So, that obviously is not the reason. Try again.

      DEBUG seemed to add no further explanations


      PS: Sorry, I apologize for snapping back, but I was tired. The error obviously says bad username/passsword, so that is the first place anyone is going to look. But still, I remember laughing at the step-by-step instructions to troubleshoot problems with computers:

      Step 1: Check to see if it is plugged in.

      Step 2: Check the switch to see if it is on.

      Step 3: Turn the switch off, and now see it the computer turns on!

      ... and then I remember that this advice turned out to be helpful :).

      So, if the computer error says that there is a bad username/password, then very likely that is what it is. Just "how?" is the question. And I have tried all the straightforward ways I could think of.

        DEBUG seemed to add no further explanations

        Please share with the class :)

        Then try

        use XMLRPC::Lite \+trace => qw(debug);
        Then try and turn DEBUG on on the server side, and share that as well. Also share WordPress version information.