Closed Rocket0L4F closed 8 years ago
errr...weird.
You just need to hook after Xpost has done its work:
class Forms3rdpartyXpost_AsCData {
const B = 'Forms3rdPartyIntegration';
function __construct() {
// hook even later than xpost so we can manipulate final output
add_filter(self::B.'_service_filter_args', array(&$this, 'post_args'), 15, 3);
}
function post_args($args, $service, $form) {
$args['body'] = sprintf('<![CDATA[%s]]>', $args['body']);
return $args;
}
}
new Forms3rdpartyXpost_AsCData(); // engage!
Throw that in your functions.php
or a plugin file.
Hey zaus, thanks for your reply, and sorry for the slow response (little holiday off the grid :) ).
I've thrown the above code in my child theme's functions.php, but I'm afraid I don't see any change in my debug POST output (no CDATA-tags wrapped aroud the XML).
The code looks good, but maybe I'm missing something? Sorry, bit of a php-noob here ;)
Thanks again!
Oh sorry, I think I forgot to instantiate the class, so the hook never got called. I've updated the sample.
You can also try the new format 'mask' option with v1.2 to explicitly control the output rather than let it generate the xml.
Can I assume Resolved? Will reopen if not...
First of all, thanks for this incredibly useful plugin :) !
Quick question (I've posted the same on wordpress.org/support): the webservice I'm currently sending data to wants me to wrap the entire XML in a CDATA-tag (don't ask me why). Would this somehow be possible?
Thanks in advance!