WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
[resolved] posting through API via curl (2 posts)

  1. lego123
    Member
    Posted 1 year ago #

    First off, I would like to say that this plugin is the bomb! Anyways aside from it being so awesome, I'm having trouble using create_post method via curl in php. I have created a class to access the API via cURL and will will log me via curl if necessary. I seem to have all the cookies required for authentication in my cookie jar but I keep getting the following error from the API "You need to login with a user capable of creating posts". Does anyone know why I keep getting this error? I noticed that the wordpress_logged_in cookie is prefixed with #HttpOnly_[domain], is it possible that curl ignores these values? If cURL is ignoring this how can I resolve this issue? Any input is greatly appreciated, I need this working ASAP to complete a project.

    http://wordpress.org/extend/plugins/json-api/

  2. lego123
    Member
    Posted 1 year ago #

    Nvm, I found the issue. I had to set CURLOPT_COOKIEFILE to the same file that CURLOPT_COOKIEJAR points to in order to transmit the cookies back to the server, then I had to set CURLOPT_COOKIESESSION to false in my curl settings. Everything seems to be working perfectly now.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic