Jump to content

davefootball123

Members
  • Posts

    101
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

davefootball123's Achievements

Member

Member (2/5)

0

Reputation

  1. Ended up getting the preg_match statement correct to find the name of the latest bulletin. Thanks for the help, everyone. $url = 'http://dd.weatheroffice.gc.ca/meteocode/ont/cmml/?C=M;O=A'; $contents = file_get_contents($url); preg_match_all('/(?<=")TRANSMIT.FPTO11.*(?=")/', $contents, $result); foreach ($result as $latestbulletin) { $latest = end($latestbulletin); }
  2. Really appreciate all the help. I have been playing around with some code for the past couple of hours and am wondering why glob() returns empty when sorting by file modification time. It seems like the time stamped data isn't being read. The way I had previously done this for a directory was get the content of the folder and sort the filenames, however the preg_match statement is a bit more complicated for this one. I will try a few more things then report back.. Once agian, thanks for the help.
  3. Thanks for your help as well, have been looking at examples for quite some time.
  4. Really appreciate all of the help! Will this work to just grab the FTP011 files though? Thanks,
  5. Hello, I am having a bit of trouble with a preg_match statement. I have a directory of files at http://dd.weatheroffice.ec.gc.ca/meteocode/ont/cmml/ and I am trying to get the latest FPT011 file in the directory. I have some code below showing what I am trying to accomplish however I'm having trouble with the last part of the preg_match statement. Any help would be greatly appreciated. Thanks, $url = 'http://dd.weatheroffice.ec.gc.ca/meteocode/ont/cmml/'; $contents = file_get_contents($url); preg_match_all('/(?<=")TRANSMIT.FPT011............(?=")/', $contents, $result); foreach ($result as $latestbulletin) { $latest = end($latestbulletin); echo $latest; }
  6. Hello all, this issue really has me stumped. I'm actually a bit unsure of where to start. There are a bunch of files in a directory shown here. http://dd.weatheroffice.ec.gc.ca/bulletins/alphanumeric/20130911/WU/CWTO/00/ What I need to do is get the latest WUCN12 bulletin from the directory. As you can see they have a creation date, however I am unsure of how to grab the latest one of the WUCN12 bulletin. Any help would be great,
  7. Hello, I have a KML layer with clickable: true, set and I can't seem to figure out how to do clickable_changed to false when a button is clicked. The function is called changeclick() and is executed on button click however I can't figure out how to have it change the clickable parameter to false. If anyone could point me in the right direction that would be greatly appreciated. Thanks,
  8. I have a MYSQL database that stores warning information for given regions, there are about 30 or 40 regions that I cover. If a warning is issued for the region the "type" row in the MYSQL database will be filled with the type of warning in effect for that given region. Often multiple regions have the same type of warning, and what I am looking to do is just get the first instance of each warning type in the database so I can create a legend with the warnings that are in effect. Any help would be great, if you need anymore information on how the db is setup, please let me know. Thanks for your time, Dave
  9. Thanks for the response Christian. This does require preg_match due to the variability of warning text. I have my php script shown below. What I do is I read a text file...check tornado warning and break it up into individual regions..it works great however it gets caught on the period of ST. CATHARINES in the text file and fails to go any further. I need to figure out somehow to match the period there while no going past it into the TORNADO WARNINGS ENDED FOR: section of the text file. Text file is linked below. http://www.sowx.ca/weathercentrealerts/weathercentretest.txt <?php $warnarea = array ( 'WINDSOR - LEAMINGTON - ESSEX COUNTY' => array('WINDSOR - LEAMINGTON - ESSEX COUNTY'), 'CHATHAM-KENT - RONDEAU PARK' => array('CHATHAM-KENT - RONDEAU PARK'), 'WINDSOR - ESSEX - CHATHAM-KENT' => array('WINDSOR - LEAMINGTON - ESSEX COUNTY', 'CHATHAM-KENT - RONDEAU PARK'), 'SARNIA - LAMBTON' => array('SARNIA - PETROLIA - WESTERN LAMBTON COUNTY', 'WATFORD - PINERY PARK - EASTERN LAMBTON COUNTY'), 'SARNIA - PETROLIA - WESTERN LAMBTON COUNTY' => array('SARNIA - PETROLIA - WESTERN LAMBTON COUNTY'), 'WATFORD - PINERY PARK - EASTERN LAMBTON COUNTY' => array('WATFORD - PINERY PARK - EASTERN LAMBTON COUNTY'), 'ELGIN' => array('RODNEY - SHEDDEN - WESTERN ELGIN COUNTY', 'ST. THOMAS - AYLMER - EASTERN ELGIN COUNTY'), 'RODNEY - SHEDDEN - WESTERN ELGIN COUNTY' => array('RODNEY - SHEDDEN - WESTERN ELGIN COUNTY'), 'ST. THOMAS - AYLMER - EASTERN ELGIN COUNTY' => array('ST. THOMAS - AYLMER - EASTERN ELGIN COUNTY'), 'SIMCOE - DELHI - NORFOLK' => array('SIMCOE - DELHI - NORFOLK'), 'DUNNVILLE - CALEDONIA - HALDIMAND' => array('DUNNVILLE - CALEDONIA - HALDIMAND'), 'NIAGARA' => array('NIAGARA FALLS - WELLAND - SOUTHERN NIAGARA REGION', 'ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION'), 'NIAGARA FALLS - WELLAND - SOUTHERN NIAGARA REGION' => array('NIAGARA FALLS - WELLAND - SOUTHERN NIAGARA REGION'), 'ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION' => array('ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION'), 'CITY OF HAMILTON' => array('CITY OF HAMILTON'), 'OXFORD - BRANT' => array('BRANTFORD - COUNTY OF BRANT', 'WOODSTOCK - TILLSONBURG - OXFORD COUNTY'), 'WOODSTOCK - TILLSONBURG - OXFORD COUNTY' => array('WOODSTOCK - TILLSONBURG - OXFORD COUNTY'), 'BRANTFORD - COUNTY OF BRANT' => array('BRANTFORD - COUNTY OF BRANT'), 'LONDON - MIDDLESEX' => array('LONDON - PARKHILL - EASTERN MIDDLESEX COUNTY', 'STRATHROY - KOMOKA - WESTERN MIDDLESEX COUNTY'), 'LONDON - PARKHILL - EASTERN MIDDLESEX COUNTY' => array('LONDON - PARKHILL - EASTERN MIDDLESEX COUNTY'), 'STRATHROY - KOMOKA - WESTERN MIDDLESEX COUNTY' => array('STRATHROY - KOMOKA - WESTERN MIDDLESEX COUNTY'), 'HURON - PERTH' => array('WINGHAM - BLYTH - NORTHERN HURON COUNTY', 'LISTOWEL - MILVERTON - NORTHERN PERTH COUNTY', 'GODERICH - BLUEWATER - SOUTHERN HURON COUNTY', 'STRATFORD - MITCHELL - SOUTHERN PERTH COUNTY'), 'WINGHAM - BLYTH - NORTHERN HURON COUNTY' => array('WINGHAM - BLYTH - NORTHERN HURON COUNTY'), 'LISTOWEL - MILVERTON - NORTHERN PERTH COUNTY' => array('LISTOWEL - MILVERTON - NORTHERN PERTH COUNTY'), 'GODERICH - BLUEWATER - SOUTHERN HURON COUNTY' => array('GODERICH - BLUEWATER - SOUTHERN HURON COUNTY'), 'STRATFORD - MITCHELL - SOUTHERN PERTH COUNTY' => array('STRATFORD - MITCHELL - SOUTHERN PERTH COUNTY'), 'WATERLOO - WELLINGTON' => array('KITCHENER - CAMBRIDGE - REGION OF WATERLOO', 'GUELPH - ERIN - SOUTHERN WELLINGTON COUNTY', 'MOUNT FOREST - ARTHUR - NORTHERN WELLINGTON COUNTY'), 'KITCHENER - CAMBRIDGE - REGION OF WATERLOO' => array('KITCHENER - CAMBRIDGE - REGION OF WATERLOO'), 'GUELPH - ERIN - SOUTHERN WELLINGTON COUNTY' => array('GUELPH - ERIN - SOUTHERN WELLINGTON COUNTY'), 'MOUNT FOREST - ARTHUR - NORTHERN WELLINGTON COUNTY' => array('MOUNT FOREST - ARTHUR - NORTHERN WELLINGTON COUNTY'), 'HALTON - PEEL' => array('CALEDON', 'MISSISSAUGA - BRAMPTON', 'HALTON HILLS - MILTON', 'BURLINGTON - OAKVILLE'), 'CALEDON' => array('CALEDON'), 'MISSISSAUGA - BRAMPTON' => array('MISSISSAUGA - BRAMPTON'), 'HALTON HILLS - MILTON' => array('HALTON HILLS - MILTON'), 'BURLINGTON - OAKVILLE' => array('BURLINGTON - OAKVILLE'), 'CITY OF TORONTO' => array('CITY OF TORONTO'), 'GREY - BRUCE' => array('BRUCE PENINSULA - SAUBLE BEACH - TOBERMORY', 'OWEN SOUND - BLUE MOUNTAINS - NORTHERN GREY COUNTY', 'SAUGEEN SHORES - KINCARDINE - SOUTHERN BRUCE COUNTY', 'HANOVER - DUNDALK - SOUTHERN GREY COUNTY'), 'BRUCE PENINSULA - SAUBLE BEACH - TOBERMORY' => array('BRUCE PENINSULA - SAUBLE BEACH - TOBERMORY'), 'OWEN SOUND - BLUE MOUNTAINS - NORTHERN GREY COUNTY' => array('OWEN SOUND - BLUE MOUNTAINS - NORTHERN GREY COUNTY'), 'SAUGEEN SHORES - KINCARDINE - SOUTHERN BRUCE COUNTY' => array('SAUGEEN SHORES - KINCARDINE - SOUTHERN BRUCE COUNTY'), 'HANOVER - DUNDALK - SOUTHERN GREY COUNTY' => array('HANOVER - DUNDALK - SOUTHERN GREY COUNTY'), 'DUFFERIN - INNISFIL' => array('INNISFIL - NEW TECUMSETH - ANGUS', 'SHELBURNE - MANSFIELD - NORTHERN DUFFERIN COUNTY', 'ORANGEVILLE - GRAND VALLEY - SOUTHERN DUFFERIN COUNTY'), 'INNISFIL - NEW TECUMSETH - ANGUS' => array('INNISFIL - NEW TECUMSETH - ANGUS'), 'SHELBURNE - MANSFIELD - NORTHERN DUFFERIN COUNTY' => array('SHELBURNE - MANSFIELD - NORTHERN DUFFERIN COUNTY'), 'ORANGEVILLE - GRAND VALLEY - SOUTHERN DUFFERIN COUNTY' => array('ORANGEVILLE - GRAND VALLEY - SOUTHERN DUFFERIN COUNTY'), 'BARRIE - ORILLIA - MIDLAND' => array('MIDLAND - COLDWATER - ORR LAKE', 'ORILLIA - LAGOON CITY - WASHAGO', 'BARRIE - COLLINGWOOD - HILLSDALE'), 'BARRIE - COLLINGWOOD - HILLSDALE' => array('BARRIE - COLLINGWOOD - HILLSDALE'), 'ORILLIA - LAGOON CITY - WASHAGO' => array('ORILLIA - LAGOON CITY - WASHAGO'), 'MIDLAND - COLDWATER - ORR LAKE' => array('MIDLAND - COLDWATER - ORR LAKE'), 'YORK - DURHAM' => array('UXBRIDGE - BEAVERTON - NORTHERN DURHAM REGION', 'NEWMARKET - GEORGINA - NORTHERN YORK REGION', 'PICKERING - OSHAWA - SOUTHERN DURHAM REGION', 'VAUGHAN - RICHMOND HILL - MARKHAM'), 'UXBRIDGE - BEAVERTON - NORTHERN DURHAM REGION' => array('UXBRIDGE - BEAVERTON - NORTHERN DURHAM REGION'), 'NEWMARKET - GEORGINA - NORTHERN YORK REGION' => array('NEWMARKET - GEORGINA - NORTHERN YORK REGION'), 'PICKERING - OSHAWA - SOUTHERN DURHAM REGION' => array('PICKERING - OSHAWA - SOUTHERN DURHAM REGION'), 'VAUGHAN - RICHMOND HILL - MARKHAM' => array('VAUGHAN - RICHMOND HILL - MARKHAM'), 'PETERBOROUGH - KAWARTHA LAKES' => array('FENELON FALLS - BALSAM LAKE PARK - NORTHERN KAWARTHA LAKES', 'APSLEY - WOODVIEW - NORTHERN PETERBOROUGH COUNTY', 'LINDSAY - SOUTHERN KAWARTHA LAKES', 'PETERBOROUGH CITY - LAKEFIELD - SOUTHERN PETERBOROUGH COUNTY'), 'FENELON FALLS - BALSAM LAKE PARK - NORTHERN KAWARTHA LAKES' => array('FENELON FALLS - BALSAM LAKE PARK - NORTHERN KAWARTHA LAKES'), 'APSLEY - WOODVIEW - NORTHERN PETERBOROUGH COUNTY' => array('APSLEY - WOODVIEW - NORTHERN PETERBOROUGH COUNTY'), 'LINDSAY - SOUTHERN KAWARTHA LAKES' => array('LINDSAY - SOUTHERN KAWARTHA LAKES'), 'PETERBOROUGH CITY - LAKEFIELD - SOUTHERN PETERBOROUGH COUNTY' => array('PETERBOROUGH CITY - LAKEFIELD - SOUTHERN PETERBOROUGH COUNTY'), 'BELLEVILLE - QUINTE - NORTHUMBERLAND' => array('BELLEVILLE - QUINTE WEST - EASTERN NORTHUMBERLAND COUNTY', 'COBOURG - COLBORNE - WESTERN NORTHUMBERLAND COUNTY'), 'BELLEVILLE - QUITE WEST - EASTERN NORTHUMBERLAND COUNTY' => array('BELLEVILLE - QUITE WEST - EASTERN NORTHUMBERLAND COUNTY'), 'COBOURG - COLBORNE - WESTERN NORTHUMBERLAND COUNTY' => array('COBOURG - COLBORNE - WESTERN NORTHUMBERLAND COUNTY') ); $data = file_get_contents('/home/sowx/public_html/weathercentrealerts/weathercentretest.txt'); if (preg_match_all('/([\w\s]+TORNADO WARNING FOR:)(.+?)\./s' , $data, $tt)) { for($i=0; $i < count($tt[0]); $i++) { $warnname[$i] = trim(rtrim($tt[1][$i])); $locales[$i] = $tt[2][$i]; $localclean = preg_replace('/\=NEW\=/' , "" , $locales[$i]); $locations = preg_split('/[\r\n]/' , $localclean); foreach($locations as $set) { $location = trim(rtrim($set)); if(array_key_exists($location, $warnarea)) { foreach($warnarea[$location] as $subregion) { echo $subregion.'<BR>'; } } } } } ?>
  10. Sorry for the bump. I really do need some help. Thanks again, Dave
  11. EDIT: The statement is supposed to be /TORNADO WARNING FOR:+[=NEW=\w\s\'\-\.]+\b('.$region.')\b/ Sorry about that. The period in the expression needs to be there because often there are multiple locations after ST. CATHARINES... and if there period isnt matched then it wont go past that point. Dave,
  12. Hey all. I thought I had this issue fixed however I dont...I have a text file listed below and my preg_match statement is /TORNADO WARNING FOR:+[=NEW=\w\s\'\-]+\b('.$region.')\b/ $warnarea = array 'NIAGARA' => array('s0000076', 's0000691'), 'NIAGARA FALLS - WELLAND - SOUTHERN NIAGARA REGION' => array('s0000076'), 'ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION' => array('s0000691'); in the array there are 3 values which I loop through with the preg_match statement 013 WFCN11 CWTO 250127 TORNADO WARNING UPDATED BY ENVIRONMENT CANADA AT 9:27 PM EDT WEDNESDAY 24 AUGUST 2011. --------------------------------------------------------------------- TORNADO WARNING FOR: ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION The text file above...as you can see should only match the one array value 'ST. CATHARINES - GRIMSBY - NORTHERN NIAGARA REGION' however it matches that and NIAGARA....this is beucase in the preg_match expression I have it matching a period as well....this is the only thing causing my issue however I have no clue how to fix it. Any help would be greatly appreciated. Thanks, Dave
  13. fixed it with if (preg_match('/\bRAINFALL WARNING FOR:+[=NEW=\w\s\'\-]+('.$region.')\b/', $svs)) { Sorry about the post...
  14. The preg_match statement is matching each character...I guess what I need is for it to match the full piece of text or else its not a match. Any Ideas on how to do this would greatly appreciated! Thanks, Dave
  15. I have a statement if (preg_match('/RAINFALL WARNING FOR:[\s\w\-\=NEW=\'\.]+CALEDON/', $svs)) { to match a Rainfall Warning for the town of Caledon...however it is saying there is a match for the text below...this is because CALEDONIA has the same first 7 letters as CALEDON...how would I stop this from matching.... Thanks for your help. Dave 697 WWCN11 CWTO 091842 SEVERE WEATHER BULLETIN ISSUED BY ENVIRONMENT CANADA AT 2:42 PM EDT TUESDAY 9 APRIL 2013. --------------------------------------------------------------------- WATCHES/WARNINGS IN EFFECT FOR SOUTHERN ONTARIO... RAINFALL WARNING FOR: =NEW= WINDSOR - ESSEX - CHATHAM-KENT =NEW= SARNIA - LAMBTON =NEW= ELGIN =NEW= LONDON - MIDDLESEX =NEW= SIMCOE - DELHI - NORFOLK =NEW= DUNNVILLE - CALEDONIA - HALDIMAND =NEW= OXFORD - BRANT. HEAVY RAINFALL INTO THURSDAY. --------------------------------------------------------------------- ==DISCUSSION== A SERIES OF LOW PRESSURE SYSTEMS WILL GIVE PERIODS OF RAIN TO THE REGIONS FROM THIS EVENING THROUGH WEDNESDAY AND INTO THURSDAY. THE RAIN WILL BE HEAVY AT TIMES WITH ISOLATED THUNDERSTORMS ALSO EXPECTED. RAINFALL AMOUNTS OF 50 TO 80 MM ARE EXPECTED BY THURSDAY. THE RAIN WILL LIKELY CHANGE TO FREEZING RAIN THURSDAY IN THE LONDON AND OXFORD AREAS. TO THE SOUTH, NEAR LAKE ERIE, ADDITIONAL RAINFALL AMOUNTS ARE EXPECTED BEFORE THE RAIN CHANGES TO SOME SNOW FRIDAY. REFER TO YOUR LOCAL PUBLIC FORECAST FOR FURTHER DETAILS. END/OSPC
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.