I am trying to setup a xml for a friend of mine.. the source is a remote http server ...and you can send differnt api request to it and you recieve a responce depending on the request.
In the api documentation it says the userid and login id must be base 64 encoded..The api request query i send to the remote server I encode the userid and login id.
I am trying to echo the responce and all get is encoded message.I am been trying to figure out what i need to do to decode it.i tried echo base64_decode($str); but all i get is blank page ..if i do just echo $responce then i get a responce but is un readable.
here is the code ii am trying to use.i am usng php 5
the problem is that your trying to decode the whole xml file even though only the contents is encoded.
PHP Code:
echo base64_decode('S2V5Ym9hcmQ='); // outputs 'keyboard' which seems correct
To get around this you need to parse the xml file and decode only the content of your elements. To ease the parsing process php offers two built in classes (atleast in php5), SimpleXML and XMLParser.
SimpleXML is indeed easy and looping trough the object it creates is pretty simple. Hope that helps you some.