PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I don't understand what this means. Since I still don't really know your issue, let me suggest removing all the @ in your code to see if any errors are being generated.
This is what happening. From fsockopen, I am trying to open a PHP file which outputs XML
I am storing the file content in a variable. And if try to echo the variable,
If i restart apache, I am getting 17 (view source gives complete xml_data)
When i refresh the browser now, I am getting 4a 17 0 (view source gives complete 4a xml_data 0)
Now instead of PHP file, (I have created a static XML file in the same place. ) If i call xml file, at any number of refresh gives 17.
I am not able to predict whether there is a problem in localhost or from live server.
I am that php file which produce xml in live server. and i am testing fsockopen from my localhost.
Apache restart gives me a clue that problem in localhost.
When Calling directly static XML file from live server tells me there is a problem in PHP file which produce xml.
Just to be clear, those odd characters are the result of you not parsing the HTTP response correctly. They are used for chunked-encoding, if memory serves (which is why I recommend you do not attempt to parse responses, and preferably use cURL).
It is kind of script which will get data from my database. and the script is free for few people.
* Is using Curl a safe method?
* Generally every server will have curl enabled?
Weirdan wrote:Your original problem was that server was sending the reply in chunked transfer encoding and you didn't decode it. Curl does that behind the scene.
curl library is usually available on most hosting plans nowadays.
Okay. I will go ahead with CURL.
Is it difficult to decode it?