XML-RPC server accepts POST requests only
-
In my Laravel project, I am using this package hieu-le/wordpress-xmlrpc-client to publish content to WordPress blog. Everything works very well except for uploading media files.When I upload file up to 850 KB, the file uploaded successfully. But when the file size exceeds 850 KB I get this error message XML-RPC server accepts POST requests only. And in my opinion this is unthinkable because I am using the same function to upload a file and the request method is always POST. This is my code.
$item = WpDetails::where("user_id", $user->id)->first(); $endpoint = $item->wp_url . '/xmlrpc.php'; $wpUser = $item->wp_username; $wpPass = $item->wp_password; $wpClient = new HieuLeWordpressXmlrpcClientWordpressClient(); $wpClient->setCredentials($endpoint, $wpUser, $wpPass); ob_clean(); $headers = get_headers($file->refe_file_path, TRUE); $mimType = $headers['Content-Type']; $output = ''; $handle = fopen($file->s3_file_path, 'r'); if ($handle) { while (!feof($handle)) { $output .= fread($handle, 1048576); } fclose($handle); } $uploadMedia = $wpClient->uploadFile($file->real_file_name, $mimType, $output, false); $attachmentId = $uploadMedia['attachment_id']; $content = [ 'post_type' => 'post', 'post_status' => $request->input('post_status'), 'post_title' => $title, 'post_excerpt' => $request->input('post_excerpt'), 'post_content' => $request->input('post_content'), 'post_format' => $request->input('post_format'), 'post_thumbnail' => $attachmentId, 'terms_names' => [ 'category' => $request->input('post_category'), 'post_tag' => $request->input('post_tags'), ], 'post_author' => $request->input('post_author'), ]; -
Hello there,
Many thanks for reaching out.
Are you able to confirm the URL of the website that you need assistance with please?
Many thanks.
-
-
Hi there,
I checked your site and it is using the open-source WordPress.org software, so you’ll need to seek help at these forums:
https://wordpress.org/support/forums/
These forums are for WordPress.com-hosted sites only. Since we do not have access to self-hosted WordPress.org sites, we are unable to provide any direct assistance to your issue. I would also reach out to your site host for help. Looks like the site is hosted with GoDaddy.
If you want to know more about the differences between WordPress.com and WordPress.org you can read this document:
Thanks!
-
- The topic ‘XML-RPC server accepts POST requests only’ is closed to new replies.