WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] XMLRPC posting (8 posts)

  1. Ashfame
    Member
    Posted 4 years ago #

    How can I post through XMLRPC in WordPress using PHP?

    I need full fledged functionality. Please point in some direction.

  2. MichaelH
    Member
    Posted 4 years ago #

  3. Ashfame
    Member
    Posted 4 years ago #

    Thanks for the link Michael! Didn't find that at first.

    Looking forward to more resources (I like the one with examples :P)

  4. MichaelH
    Member
    Posted 4 years ago #

  5. MichaelH
    Member
    Posted 4 years ago #

  6. Ashfame
    Member
    Posted 4 years ago #

    Thanks for the link! 3rd one, that was I wanted exactly.

    Get around with someone who does it every now and then ;)

  7. tonybaldwin
    Member
    Posted 4 years ago #

    The Codex page doesn't give information on how to send a post request (has everything else, like editing categories, to adding media...but no post request...hello!).

    Trying to do that in Xpostulate (tcl/tk blog client), like this:

    proc wppost {} {
    
    set content [.txt.txt get 1.0 end]
    set escaped [string map {
    	"<" "<"
    	">" ">"
    	\"  "\""
    	} $content]
    .txt.txt delete 1.0 end
    .txt.txt insert insert $escaped
    
    set ptext [.txt.txt get 1.0 {end -1c}]
    set time [clock format [clock seconds] -format %G%m%dT%T]
    
    global mypost
    set mypost "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <methodName>metaWeblog.newPost</methodName>
    <params>
    <param><value><string>MyBlog</string></value></param>
    <param><value>$::wpname</value></param>
    <param><value><string>$::wppswd</string></value></param>
    <param><struct>
    <member><name>categories</name><value><array><data><value>$::cats</value></data></array></value></member>
    <member><name>description</name><value>$ptext</value></member>
    <member><name>title</name><value>$::subject</value></member>
    <member><name>dateCreated</name><value><dateTime.iso8601>$time</ dateTime.iso8601></value></member>
    </struct>
    </param>
    <param>
     <value>
      <boolean>1</boolean>
     </value>
    </param>
    </params>
    </methodCall>"
    
    set plength [string length $ptext]
    
    set dopost [http::geturl http://$::wpname.wordpress.com/xmlrpc.php -query $::mypost -type "text/xml" ]
    set wpstat [http::status $dopost]
    set wpresponse [http::data $dopost]
    
    toplevel .rsp
    wm title .rsp "Post Status"
    
    frame .rsp.btns
    grid [tk::label .rsp.btns.lbl -text "WP says: $wpstat\nPost length: $plength"]
    grid [tk::button .rsp.btns.view -text "View Journal" -command {
        set wpu "http://$::wpname.wordpress.com"
        exec $::brow $wpu &
    }]\
    [tk::button .rsp.btns.ok -text "DONE" -command {destroy .rsp}]
    
    frame .rsp.txt
    text .rsp.txt.t -width 80 -height 20
    .rsp.txt.t insert end $wpresponse
    
    pack .rsp.btns -in .rsp -side top -fill x
    pack .rsp.txt.t -in .rsp.txt -side top -fill x
    pack .rsp.txt -in .rsp -side top -fill x
    
    }

    Getting this response:

    <?xml version="1.0"?>
    <methodResponse>
      <fault>
        <value>
          <struct>
            <member>
              <name>faultCode</name>
              <value><int>-32700</int></value>
            </member>
            <member>
              <name>faultString</name>
              <value><string>parse error. not well formed</string></value>
            </member>
          </struct>
        </value>
      </fault>
    </methodResponse>

    I am successfully posting to livejournal, dreamwidth, and other Lj clones using the xmlrpc method, but not finding good documentation on the difference between an LJ post and a WP post.
    Clearly, some LJ props (current_mood, current_music) are not relevant, etc.
    The above xml attempt is based on info from http://msdn.microsoft.com/en-us/library/aa905673.aspx

    Any idea where my xml is malformed?
    Am I missing a relevant or required variable?
    Any ideas?

    thanks
    tony

  8. Joseph Scott
    Member
    Posted 4 years ago #

    @ tonybaldwin -

    Please don't repost the same question across multiple threads, it makes it hard to follow along. I replied here - http://wordpress.org/support/topic/386185?replies=3#post-1472008

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags