Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 47727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:10:05+00:00 2026-05-10T16:10:05+00:00

I wrote a small PHP application several months ago that uses the WordPress XMLRPC

  • 0

I wrote a small PHP application several months ago that uses the WordPress XMLRPC library to synchronize two separate WordPress blogs. I have a general ‘RPCRequest’ function that packages the request, sends it, and returns the server response, and I have several more specific functions that customize the type of request that is sent.

In this particular case, I am calling ‘getPostIDs’ to retrieve the number of posts on the remote server and their respective postids. Here is the code:

$rpc = new WordRPC('http://mywordpressurl.com/xmlrpc.php', 'username', 'password'); $rpc->getPostIDs(); 

I’m receiving the following error message:

expat reports error code 5 description: Invalid document end line: 1 column: 1 byte index: 0 total bytes: 0  data beginning 0 before byte index:  

Kind of a cliffhanger ending, which is also strange. But since the error message isn’t formatted in XML, my intuition is that it’s the local XMLRPC library that is generating the error, not the remote server.

Even stranger, if I change the ‘getPostIDs()’ call to ‘getPostIDs(1)’ or any other integer, it works just fine.

Here is the code for the WordRPC class:

public function __construct($url, $user, $pass) {   $this->url = $url;   $this->username = $user;   $this->password = $pass;    $id = $this->RPCRequest('blogger.getUserInfo',                           array('null', $this->username, $this->password));   $this->blogID = $id['userid']; }  public function RPCRequest($method, $params) {   $request = xmlrpc_encode_request($method, $params);   $context = stream_context_create(array('http' => array(                     'method' => 'POST',                     'header' => 'Content-Type: text/xml',                     'content' => $request   )));    $file = file_get_contents($this->url, false, $context);   return xmlrpc_decode($file); }  public function getPostIDs($num_posts = 0) {   return $this->RPCRequest('mt.getRecentPostTitles',                             array($this->blogID, $this->username,                             $this->password, $num_posts)); } 

As I mentioned, it works fine if ‘getPostIDs’ is given a positive integer argument. Furthermore, this used to work perfectly well as is; the default parameter of 0 simply indicates to the RPC server that it should retrieve all posts, not just the most recent $num_posts posts. Only recently has this error started showing up.

I’ve tried googling the error without much luck. My question, then, is what exactly does ‘expat reports error code 5’ mean, and who is generating the error? Any details/suggestions/insights beyond that are welcome, too!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:10:05+00:00Added an answer on May 10, 2026 at 4:10 pm

    @Novak: Thanks for your suggestion. The problem turned out to be a memory issue; by retrieving all the posts from the remote location, the response exceeded the amount of memory PHP was allowed to utilize, hence the unclosed token error.

    The problem with the cryptic and incomplete error message was due to an outdated version of the XML-RPC library being used. Once I’d upgraded the version of WordPress, it provided me with the complete error output, including the memory error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 112k
  • Answers 112k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The easiest solution to your problem is to create a… May 11, 2026 at 9:55 pm
  • Editorial Team
    Editorial Team added an answer I believe this question has been asked here before... Here's… May 11, 2026 at 9:55 pm
  • Editorial Team
    Editorial Team added an answer I ended up just sending the SID in GET and… May 11, 2026 at 9:55 pm

Related Questions

I wrote a small PHP application that I'd like to distribute. I'm looking for
I am looking to write a small application that receives an SMS text message
We are a small team of developers planing to develop a php application. (let's
So I am just starting out developing PHP web applications and have finished setting

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.