maxudaskin Posted January 7, 2008 Share Posted January 7, 2008 Is there any way to open the following files with fopen or anything that can take the information on demand and put it into another file? ftp://tgftp.nws.noaa.gov/data/observations/metar/stations Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/ Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 Is there any way to open the following files with fopen or anything that can take the information on demand and put it into another file? ftp://tgftp.nws.noaa.gov/data/observations/metar/stations You can use file_get_contents() Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432350 Share on other sites More sharing options...
maxudaskin Posted January 7, 2008 Author Share Posted January 7, 2008 I get an error... is there any other way? Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/.grable/vzoom/virtualzoom.net/ops/flights.php on line 267 Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432353 Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> http://uk3.php.net/curl Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432362 Share on other sites More sharing options...
maxudaskin Posted January 7, 2008 Author Share Posted January 7, 2008 I found a URL that works... but now it gives me this error: Warning: file() expects parameter 2 to be long, string given in /home/.grable/vzoom/virtualzoom.net/ops/flights.php on line 267 Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432375 Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 Can you post your code? Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432379 Share on other sites More sharing options...
maxudaskin Posted January 7, 2008 Author Share Posted January 7, 2008 <?php $page = $_GET['p']; if ($_GET['p'] == "board" || isset($_GET['searchfield'])){ flights(); }elseif($_GET['p'] == "file"){ fileflight(); }elseif($_GET['p'] == "map"){ echo 'ERROR: Flight Map Cannot be Loaded.'; }elseif($_GET['p'] == "book"){ if(isset($_POST['bid_flight'])){ $dept = $_POST['dept']; $dest = $_POST['dest']; $deptmetarf = file("http://weather.noaa.gov/pub/data/forecasts/taf/stations/".$dept.".TXT","r"); $deptmetar = $deptmetarf[1]; $destmetarf = file("http://weather.noaa.gov/pub/data/forecasts/taf/stations/".$dest.".TXT","r"); $destmetar = $destmetarf[1]; $route = $_POST['route']; $detailedroute = $_POST['detailedroute']; $my_t=getdate(date("U")); echo '<span class="fpln">'; echo 'OOM'.$_SESSION["username"].' '.$_POST['dept'].'-'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes]; echo '<br />'; echo '</span>'; $text = $_SESSION["username"].' '.$_POST['dept'].'/'.$_POST['dest'].' '.$my_t[mday].'.'.$my_t[month].'.'.$my_t[year].'/'.$my_t[hours].''.$my_t[minutes].' FP '.$_POST['fltnum'].' '.$_POST['aircraft'].' '.$_POST['acftreg'].' '.$_SESSION['rank'].' '.$_SESSION['name'].' RMKS '.$rmks.' '.$route.' '.$detailedroute.' METARS Departure '. $deptmetar .' Dest '. $destmetar ; $filename = 'OOM'.$_SESSION["username"].'_'.$_POST['dept'].'-'.$_POST['dest'].'_'.$my_t[mday].' '.$my_t[month].' '.$my_t[year].'_'.$my_t[hours].''.$my_t[minutes].' '.$my_t[minutes].'.txt'; $file = fopen("../ops/fplns/".$filename,"w"); echo fwrite($file,$text); fclose($file); echo '<a href="fplns/'.$filename.'">Download Flight Plan</a>'; }else{ $fltnum = $_GET['f']; $book_data_sql = mysql_query("select * from flights WHERE flight_num = '{$fltnum}'"); while($book_data = mysql_fetch_array($book_data_sql)){ $dept = $book_data['depticao']; $dest = $book_data['desticao']; $aircraft = $book_data['aircraft']; $route = $book_data['route']; $detailedroute = $book_data['detailed_route']; } $regrand = rand(1,5); ?> There is some irrelevant HTML code below... it is just the form. Quote Link to comment https://forums.phpfreaks.com/topic/84810-solved-fopen/#findComment-432383 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.