defeated Posted January 22, 2009 Share Posted January 22, 2009 Hi I have a problem. I am transferring info from one site to another using xml. I can get it to work if I have the xml in a file, but I don't want it in a file. I want it in a string. I tried $xml="<?xml version='1.0' encoding='UTF-8'?> <transaction> <name>Gordon Smyth</name> <age>15</age> <content><![CDATA[<p>Just some random text</p><ul><li>asfsaf</li><li>saasffdasf</li></ul>]]></content> </transaction>" ; but the "<?xml" bit causes a problem for some reason. I'm sure I'm just doing something stupid with the syntax but I don't know what. Please help. Link to comment https://forums.phpfreaks.com/topic/141925-im-doing-something-stupid-help/ Share on other sites More sharing options...
Mchl Posted January 22, 2009 Share Posted January 22, 2009 Use simplexml instead. Link to comment https://forums.phpfreaks.com/topic/141925-im-doing-something-stupid-help/#findComment-743103 Share on other sites More sharing options...
defeated Posted January 22, 2009 Author Share Posted January 22, 2009 ??? I don't follow. I'm using simplexml to parse the data the other end. Do you mean $xml=simplexml("<?xml version='1.0' encoding='UTF-8'?> <transaction> <name>Gordon Smyth</name> <age>15</age> <content><![CDATA[<p>Just some random text</p><ul><li>asfsaf</li><li>saasffdasf</li></ul>]]></content> </transaction>") ; That gives an undefined function error and without quotes gives an unexpected "<" error. Also I could be in real trouble if any of the CDATA contents contained quotes which is quite possible. Would I be better off writing a temp file and then deleting it? I have avoided that because I don't know how yet.... but I'm sure it's not too hard. Link to comment https://forums.phpfreaks.com/topic/141925-im-doing-something-stupid-help/#findComment-743123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.