jeeva Posted December 15, 2009 Share Posted December 15, 2009 Hi frnds, i have a problem with base64_encode i'm using base64_encode function in xml like $content="some word document content here"; $xml="<content><![CDATA[".base64_encode($content)."]]></content>"; here its working fine.. the problem is while retrieving the content from xml $xmlcont="word document content here after removed xml tag"; echo $con=base64_decode($xmlcont); its giving some junk character. Please help what's wrong with this code? please give me some other solution if you have faced anything like this. Thanks Jeeva Quote Link to comment Share on other sites More sharing options...
jeeva Posted December 16, 2009 Author Share Posted December 16, 2009 No One...? Quote Link to comment Share on other sites More sharing options...
nafetski Posted December 16, 2009 Share Posted December 16, 2009 Your example is confusing me a little bit... My first assumption is that you might be using XML improperly, or trying to base64_decode the xml tags along in the string. My suggesion would be base64 encode it before it goes into your XML tag, and echo those results. Then compare those results to what you have after parsing (before you try and decode) and see if they are the same. Willing to be they aren't Can you post more of the example? Quote Link to comment Share on other sites More sharing options...
jeeva Posted December 16, 2009 Author Share Posted December 16, 2009 thanks nafetski, Let me explain, i'm doing some sever and client side script using SOAP. So i need to pass the value from server to client. First i'm converting word document and stored in a variable. then i will encrypt the content using base64_encode and assign the value in xml. have a look at example below Server Side: $wordcontent="document content..."; $encryptcont=base64_encrypt($wordcontent); $xml="<?xml encoding="ISO-8859-1"?> ....."; $xml.="<content><![CDATA[".$encryptcont."]]></content>"; And then, I will parse the xml in to php array Client Side: $ResArr=parsexml($xml); $content=base64_decode($ResArr[content]); Here is the problem, here i'm not getting the proper content..i'm getting some junk character... Hope you understood. Thanks Jeeva Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.