1

some weeks ago I programmed a Python script which posted some content to a Wordpress blog, but since the past week it stopped working (I haven't changed anything) and now when I run the script I get this error:

File "C:\Python27\lib\xmlrpclib.py", line 557, in feed
    self._parser.Parse(data, 0)
ExpatError: junk after document element: line 2, column 0

The function I use to post the desired content to Wordpress is this:

post_id = server.wp.newPost(blog_id, user, passw, content)

and it used to work since it started crashing for (apparently) no reason.

¿Do you now what could be the cause of this error?¿Might my Wordpress have been infected (I've checked it)?

Thanks, if you need more code to check something I'll post it, and sorry for my poor English.

Important Edit: I didn't mention that before, but the script works perfect with other wordpress blogs, it only crashes when I try to post to the WP blog I made the script for (that's why I think it the site may be infected).

When the code works the variable data used in self._parser.Parse(data, 0) has this content:

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
      <string>90</string>
      </value>
    </param>
  </params>
</methodResponse>

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
      <int>90</int>
      </value>
    </param>
  </params>
</methodResponse>

Edit: data variable is used by the library, I don't know what it should contain but debuggin i've found that when the script crashes it has this content:

<br />
<b>Warning</b>:  strpos() [<a href='function.strpos'>function.strpos</a>]: Empty delimiter in <b>/PATH/wp-includes/class-wp-xmlrpc-server.php</b> on line <b>3954</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /PATH/wp-includes/class-wp-xmlrpc-server.php:3954) in <b>/PATH/wp-includes/class-IXR.php</b> on line <b>471</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /PATH/wp-includes/class-wp-xmlrpc-server.php:3954) in <b>/PATH/wp-includes/class-IXR.php</b> on line <b>472</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /PATH/wp-includes/class-wp-xmlrpc-server.php:3954) in <b>/ANOTHER_PATH/public_ht

As I said i don't know what should 'data' contain, when the code worked I never checked what it's content was.

Guillem Cucurull
  • 1,681
  • 1
  • 22
  • 30
  • Can you paste what 'data' contains? – hd1 Nov 17 '12 at 22:20
  • well, I dont' really know what it contains, it is an intern function used by the library that is called when I use server.wp.newPost() – Guillem Cucurull Nov 17 '12 at 23:09
  • btw, debugging i've found that data contains this: – Guillem Cucurull Nov 17 '12 at 23:09
  • Why don't you post the entire script? – hd1 Nov 17 '12 at 23:13
  • I posted some new info in the main post. I think that posting the entire script would be useless, it only fails when posting to wordpress (it also posts to Blogger and it works) and posting to Wordpress is done with "post_id = server.wp.newPost(blog_id, user, passw, content)" where blog_id = 0, user and passw is my login info and content is the title, body and thumbnail of the post. – Guillem Cucurull Nov 17 '12 at 23:21
  • Your post doesn't look a thing like XML to me. Indeed, it would appear that you are getting a bunch of warnings related to header information. This is why seeing your script would indeed be helpful. – hd1 Nov 17 '12 at 23:25
  • I modified the post with some info, if you want I can post the function that posts to Wordpress, but I don't think the problem is there because it works with other WP blogs, the script only crashes when I try to publish to a certain blog. – Guillem Cucurull Nov 18 '12 at 12:01

0 Answers0