sanchez77 Posted December 28, 2010 Share Posted December 28, 2010 So my hosting server does not allow fopen anymore, so I was wondering if anyone had an alternative to copying a file from a remote server via a URL to a local folder? Any alternatives is apprecited. Quote Link to comment Share on other sites More sharing options...
Zurev Posted December 28, 2010 Share Posted December 28, 2010 http://www.php.net/manual/en/function.copy.php The copy function allows you to do that, however I'm curious who your webhost is and why they restricted fopen? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 28, 2010 Share Posted December 28, 2010 Switch to a hosting company that allows it? What are you trying to do? You might be able to use curl. Ken Quote Link to comment Share on other sites More sharing options...
sanchez77 Posted December 28, 2010 Author Share Posted December 28, 2010 hey guys, feel asleep last night, my hosting company is yahoo. I am trying to open a text file on NOAA servers, read it, put data into a table and then display the information. It was working fine and then they stopped it. This is the code I was using , now I need a new solution. $wx = array_map('trim',file("http://www.ndbc.noaa.gov/data/realtime2/BRBN4.txt")); $newwx = array(); foreach($wx as $i => $line) { if ($i > 1 && $i < { $tmp = array_filter(explode(' ',$line)); $q = "insert into brbn4 (year,month,day,hour,min,wdir,wspd,gst,waveht,dpd,apd,mwd,pres,atmp,wtmp,dewp,vis,ptdy,tide) values ('" . implode("','",$tmp) . "')"; $rw = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); } } Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 28, 2010 Share Posted December 28, 2010 If using file with a URL doesn't work, then using copy won't work either. Look into curl Ken Quote Link to comment Share on other sites More sharing options...
sanchez77 Posted December 28, 2010 Author Share Posted December 28, 2010 uggg. ok thanks, i am going to try and use curl. Thanks for your help. Quote Link to comment 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.