You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's an issue I've been dealing with for the last 3-4 days, and no matter how I try to construct my method in Swift syntax, I'm getting errors.
The method is part of the WP XMLRPC API and is called wp.newPost. The documentation states that we need to pass the following in the method parameters: (WordPress uses PHP)
int blog_id
string username
string password
struct content
string post_type
string post_status
string post_title
int post_author
string post_excerpt
string post_content
more...
I'm 100% certain that the problem lies in the way I'm passing the struct content part, as all other paramters I've passed worked with other methods.
When I check my server logs, this is the PHP error I'm seeing:
Cannot unset string offsets in /nas/content/live/sitename/wp-includes/class-wp-xmlrpc-server.php on line 1212
These are the lines referenced:
1209: /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1210: do_action( 'xmlrpc_call', 'wp.newPost' );
1211:
1212: unset( $content_struct['ID'] );
1213:
1214: return $this->_insert_post( $user, $content_struct );
My question is: How can I see the XMLRPC request that I'm sending, and possible see how things are getting passed?
Code snipper from the method:
let myInfo:[String: String] = ["post_title": "Hi there", "post_content": "Hello"]
let headeros = ["User-Agent": "xApp"]
let params: [Any] = [0, "\(WP_USERNAME)", "\(WP_PASSWORD)", myInfo]
AlamofireXMLRPC.request("\(WP_URL)", methodName: "wp.newPost", parameters: params, headers: headeros).responseString {
(response:Response<String, NSError>) -> Void in
guard response.result.isSuccess else {
print("Error in clause response isSucess for wp.newPost method")
print(response.result.error)
return
}
let davalue = response.result
print(davalue)
Without paying much attention to the body of your question, the title brought to mind Charles Proxy—that's what I use to inspect (and modify!) network requests and responses on the fly.
There's an issue I've been dealing with for the last 3-4 days, and no matter how I try to construct my method in Swift syntax, I'm getting errors.
The method is part of the WP XMLRPC API and is called wp.newPost. The documentation states that we need to pass the following in the method parameters: (WordPress uses PHP)
I'm 100% certain that the problem lies in the way I'm passing the
struct content
part, as all other paramters I've passed worked with other methods.When I check my server logs, this is the PHP error I'm seeing:
These are the lines referenced:
My question is: How can I see the XMLRPC request that I'm sending, and possible see how things are getting passed?
Code snipper from the method:
response.result.value
prints:Optional("")
response.result
prints:SUCCESS
po response
prints:You can also see that the headers I've specified were NOT passed.
The text was updated successfully, but these errors were encountered: