Hi All, I want to read an xml file which is sent through http post and store in my local disk in php. To be more clear, i have an url which send back an xml to the browser when run in IE. Now i want to save this xml in my local disk so that i have to extract the data from this xml and do the rest. Is there any guidelines for extracting data from post in php. Thanks Indu
As far as PHP is concerned the XML is just a great big text string when it comes from a form submit. Take the string and use fopen etc to create the file. You can then read it back like any other xml file.
Thanks Sarah, but im facing still problem. I suceeded in getting the contents from post when its http:// but when i use https:// the page is not loaded. when i use fsockopen an error comes like https:// is not opened. What can i do to solve this. my sample program is <?php //$handle = fopen("http://rss.news.yahoo.com/rss/highestrated/", "r"); $handle = fopen("https://....", "r"); $handle1 = fopen("test.xml","w"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); echo "https<br>"; fwrite($handle1,$contents); } fclose($handle); fclose($handle1); ?> when i change the handle to the one i commented its working. Please help me
Any easier way would be to use file(): $xml_string = file("https://www.yourdomain.com"); Hope this helps
file() returns the string as an array whereas file_get_contents() will return it as a string and should also be convenient with https connections. However, if you have issues with the secure connection you should use cURL. Bobby