serial Posted March 13, 2007 Share Posted March 13, 2007 how do i write information from a web page into a new file on my hard drive please help me Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/ Share on other sites More sharing options...
fert Posted March 13, 2007 Share Posted March 13, 2007 http://us2.php.net/manual/en/function.file-get-contents.php http://us2.php.net/manual/en/function.file-put-contents.php Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206003 Share on other sites More sharing options...
serial Posted March 13, 2007 Author Share Posted March 13, 2007 i don't me to sound ungreatful because im greatful for the reply but that doesn't help me much here is my code <?php $data = 'c:\test1.txt'; $scrambled = file_get_contents("http://www.chumley.biz/modules/programming9/programming9.php"); $f = fopen($data, 'w'); fwrite($f, $scrambled); fclose($f); } echo $scrambled; ?> Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206005 Share on other sites More sharing options...
fert Posted March 13, 2007 Share Posted March 13, 2007 <?php file_put_contents("file",file_get_contents("website")); ?> Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206009 Share on other sites More sharing options...
serial Posted March 13, 2007 Author Share Posted March 13, 2007 ok file_put_contents isn't working do i need to change something in the php conf file or is there another way to do it Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206157 Share on other sites More sharing options...
serial Posted March 13, 2007 Author Share Posted March 13, 2007 ok i have the program to make a file but the file says: uoakdshaott< br />rnemtov< br />neetneses< br />hklamoao thats in the text file but i would like it to say: uoakdshaott rnemtov neetneses hklamoao like this so i don't need the <br /> and i need it to start on a new line please help someone thank you Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206409 Share on other sites More sharing options...
wildteen88 Posted March 13, 2007 Share Posted March 13, 2007 Are you converting the newlines when you create the file? Could you post your code here. Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206449 Share on other sites More sharing options...
serial Posted March 13, 2007 Author Share Posted March 13, 2007 here you go: <?php function word_sort($word) { $letters = str_split($word); sort($letters); return implode("", $letters); } $data = 'c:\www\chumley\test3.txt'; $handle = file_get_contents('http://www.chumley.biz/modules/programming9/programming9.php'); $some = str_replace("< br />", '\n', $handle); file_put_contents('c:\www\chumley\test3.txt', $some); $scrambled = file("test2.txt"); $unscrambled = file("states.txt"); foreach ($scrambled as $w) { foreach($unscrambled as $w2) { if(word_sort(trim($w)) == word_sort(trim($w2))) echo trim($w2).":"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206665 Share on other sites More sharing options...
per1os Posted March 13, 2007 Share Posted March 13, 2007 $some = str_replace("< br />", '\n', $handle); SHOULD BE $some = str_replace("< br />", "\n", $handle); --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206668 Share on other sites More sharing options...
serial Posted March 13, 2007 Author Share Posted March 13, 2007 i just tried and then in the text file where it is mean't to be stored then there isn't a new line it all one line Quote Link to comment https://forums.phpfreaks.com/topic/42458-solved-please-help/#findComment-206672 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.