Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter TBotNik

    (@tbotnik)

    All,

    Well found and downloaded the IXR_Library.php from:

    http://scripts.incutio.com/xmlrpc/

    Using that and the following got the upload working:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    But the upload is still going up as a parent page, not as subpage.

    Could use help with understanding and correcting this.

    TBNK

    First, I’d recommend just using PHP XML-RPC library for communications. WordPress ships with the IXR library, I’d recommend it for PHP XML-RPC processing.

    Second, take a look at the raw XML being sent back and forth. Any obvious errors? Compare it to an existing client app that does work doing the same thing and see what the differences are.

    Thread Starter TBotNik

    (@tbotnik)

    J,

    Well first, since it is my first rodeo, I don’t know what you are referring to, so links and resources would be helpful?

    Second how does one trap the “raw XML”?

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    All,

    On some of my commands I keep getting this error:

    An error occurred – -32700:parse error. not well formed

    Any ideas what is wrong?

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    All,

    Appears this is a “Correct Formatting” issue.

    Ah but what I found is this code resolves, when I feed my source to this function:

    function xml_entities($text, $charset = 'Windows-1252'){
          $text = htmlentities($text, ENT_COMPAT, $charset, false); // Encode html chars
          $arr_xml_special_char = array (""","&","'",
          				     "<",">");
          $arr_xml_special_char_regex = "(?";                       // Build the regex
          foreach($arr_xml_special_char as $key => $value){
             $arr_xml_special_char_regex .= "(?!$value)";
          }
          $arr_xml_special_char_regex .= ")";
          $pattern = "/$arr_xml_special_char_regex&(".
          		 "[a-zA-Z0-9]+;)/";                             // Scan for non XML
          $replacement = '&${1}';                               // Replace non XML
          return preg_replace($pattern, $replacement, $text);
       }  // end function

    and I can even fix with this abbreviated function of:

    function fix_xml ($text, $charset = 'Windows-1252'){
          $text = htmlentities($text, ENT_COMPAT, $charset, false); // Encode html chars
          //$text = htmlspecialchars($text, ENT_COMPAT, $charset, false); // Encode html chars
          return $text;
       }  // end function

    I tried fixing it with just the “htmlspecialchars” but still get the errors and when the code/context from this is submitted to WordPress all the html formatting is lost, and it must be maintained.

    Appears I am looking only to convert specific HTML codes to their “&xxx;” equivalents. Any ideas on which codes actually need converting to meet the XML formatting rules, especially for WP?

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    OK,

    Tried this

    function fix_xml ($text, $charset = 'Windows-1252'){
          $text = urlencode($text); // Encode html chars
          //$text = htmlentities($text, ENT_COMPAT, $charset, false); // Encode html chars
          //$text = htmlspecialchars($text, ENT_COMPAT, $charset, false); // Encode html chars
          return $text;
       }  // end function

    and got worse.

    So what I’m thinking is comment out my first line in the first funtion of:
    $text = htmlentities($text, ENT_COMPAT, $charset, false); // Encode html chars
    and work at tweaking the REGEX so this goes through correctly, especially since the “&pound” is not found in the existing REGEX string and this seems to be the main source of contention.

    All feedback on this appreciated.

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    All,

    OK! After trying several more things it is appearant that XML requires all HTML character to be converted to character reps of the same and WordPress must contain something in the XML-RPC that converts the encoded HTML characters back to regular HTML, as Scribefire works fine dumping an HTML page into WordPress.

    It must be some option that I need in my upload string, so the decoding is enabled. But what is that code. I’m not finding it in my searches of the manuals. Guess I do not have right keyword sequence.

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    Joseph,

    Found you have a solution of sorts at:

    http://wordpress.org/extend/plugins/libxml2-fix/

    Also another fix suggested is at:

    http://www.w3schools.com/xml/xml_cdata.asp

    using the CDATA encoding.

    Now just need a nice clean function(s) to test both and see which is best.

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    Joseph,

    Tried your fix and still get the wrong thing.

    Look at this link please:

    http://waelinc.com/seo-%E2%80%93-articles/smo-social-media-optimization-company-for-the-city-of-addison-tx/

    You see the HTML tags are still encrypted as “<tagname>” so not being interpreted and formatting. In the edit mode, within WordPress, there are two options, a.) Visual, b.) HTML (upper right tabs) and the visual is coming out like the text should read in the HTML.

    Not quite sure how to use your fix, of the upgrade that is suppose to fix all this, but need my text to convert back to HTML as that is my source file(s).

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    All,

    Source text file for this is:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    So WP has to have a setting that causes “html_entity_decode()” to be called to allow the tags to revert back to the original HTML.

    I’ve been searching for that option, as I’m sure the WP programmers did not overlook it, but not finding it so far.

    If you know this option, please chime in!

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    Joseph,

    Saw you work and I think you can help. Please look over the code at:

    http://pastebin.com/pSYxsB5B

    and let me know what is wrong. I think either wrong hook or wrong invocation action. Let me know.

    Thanks!

    TBNK

    Hey tbotnik, I´ve got the same problem. Did you found a solution? Thanks a lot.

    Status4

    Thread Starter TBotNik

    (@tbotnik)

    Status4,

    No had to get off this project for a while, others more pressing. Went to IRC for WordPress and the experts there were clueless on this also.

    Boils down to getting the “right method” and the “right handler” and not knowing any WP internals nor philosophy, I would just have to read up on all them and try them one by one, till it works, which I currently have no time for.

    If you can get someone with WP internals knowledge to chime in on this should be able to fix in minutes.

    Thanks!

    TBNK

    Thread Starter TBotNik

    (@tbotnik)

    All,

    Well we had a WP expert Randy Hoyt speak at our Dallas PHP users group, so thinking about this again and reaching out to see who in our PHP community will assist in this effort.

    I still contend that since PHP encoding is a rudimentary function, that should have meant that encode and decode for it are included in the WP baseline fuctionality.

    Thanks!

    TBNK

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘xml-rpc question’ is closed to new replies.