goomba441 Posted March 22, 2011 Share Posted March 22, 2011 Hi there: I have a PDF form that generates an XFDF file (form field valies in XML form) and I am passing it to PHP for processing. I am having trouble pulling a specific value from the XML block because of the way that the XML data is generated and organized. Please see a sample of the XML block below: 'test.xml' file: <?xml version="1.0" encoding="UTF-8"?> <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"> <annots/><fields> <field name="Non"> <value>Off</value> </field> <field name="PayRequest"> <value>XYZ</value> </field> From the above XML snip it, once it's sent to PHP, I would like to somehow reference the "PayRequest" field value and retrieve the value "XYZ" and assign it to a variable. I have been kicking around some code that I thought should work, but doesn't appear to. If anyone could offer any insight to get it working that would be greatly appreciated. PHP Code: $prq_ret = simplexml_load_file('test.xml'); foreach($prq_ret->xpath("//field[@name='PayRequest']") as $item) { $row = simplexml_load_string($item->asXML()); //print $item->value; print $row; } Link to comment https://forums.phpfreaks.com/topic/231427-help-pulling-value-from-xml-block-using-simplexml/ Share on other sites More sharing options...
goomba441 Posted March 24, 2011 Author Share Posted March 24, 2011 A quick bump. Link to comment https://forums.phpfreaks.com/topic/231427-help-pulling-value-from-xml-block-using-simplexml/#findComment-1191905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.