Working with WordPress and used xmlrpc as an automation tool. You can get some errors like: parse error. not well formed and this is the solution how to fix this error.
How to reproduce this error
- Python 3.7
- pip install
- pip install python-wordpress-xmlrpc
- Create a new file called test.py and paste the following code into that file:
from wordpress_xmlrpc import Client, WordPressPost from wordpress_xmlrpc.methods.posts import GetPosts, NewPost from wordpress_xmlrpc.methods.users import GetUserInfo url = "http://tuatphukien.com/xmlrpc.php" username = "admin" password = "v!*pAxmyWP%I9X5gr#" wp = Client(url, username, password) print(wp.call(GetUserInfo()))
This error due to missing php-xml module on server. Install php-xml with this command after ssh to your server:
apt install -y php-xml
systemctl restart apache2
Run the script again and you can see the error disappeared.