AnotherQuestion Posted August 31, 2009 Share Posted August 31, 2009 I have an application that connects to a third party server to retrieve vehicle details. These are sent back in xml. The form I have created includes one textbox. The user enters their registration no into the TxtReg box. When the form is posted is passes the registration no through to the next page as URL Var. <?php $data = file_get_contents("https://vrm.mamsoft.co.uk/vrmlookup/vrmlookup.asmx/Find?Username=foo&Password=bar&Vrm=$_GET['RegNo']"); $fp = fopen("../Vrmdata.xml", "r"); fwrite($fp, $data); fclose($fp); ?> I am getting no errors but the file is not saving. What am i doing wrong? Link to comment https://forums.phpfreaks.com/topic/172617-solved-saving-files/ Share on other sites More sharing options...
davidonpda Posted August 31, 2009 Share Posted August 31, 2009 Have you just tried to echo the data onto the form to make sure you are getting it? Link to comment https://forums.phpfreaks.com/topic/172617-solved-saving-files/#findComment-909897 Share on other sites More sharing options...
fooDigi Posted August 31, 2009 Share Posted August 31, 2009 it looks as though you are opening the file as read-only... look into the different modes to use with fopen here... http://www.php.net/manual/en/function.fopen.php Link to comment https://forums.phpfreaks.com/topic/172617-solved-saving-files/#findComment-909898 Share on other sites More sharing options...
AnotherQuestion Posted September 5, 2009 Author Share Posted September 5, 2009 I have just change the file option to "w" and that doesnt work either $data = file_get_contents("https://vrm.mamsoft.co.uk/vrmlookup/vrmlookup.asmx/Find?Username=JOE&Password=BLOGGS&Vrm=".$_GET['RegNo']); $fp = fopen("Vrmdata.xml", "w"); fwrite($fp, $data); fclose($fp); Link to comment https://forums.phpfreaks.com/topic/172617-solved-saving-files/#findComment-913225 Share on other sites More sharing options...
AnotherQuestion Posted September 5, 2009 Author Share Posted September 5, 2009 found the error ("Vrmdata.xml", "w"); should be ("Vrmdata.xml", 'w'); Link to comment https://forums.phpfreaks.com/topic/172617-solved-saving-files/#findComment-913266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.