[Printable]
Share

Shipping Forcast Parser

Posted: Sun 6th February 2005 in Blog

Parses the Shipping Forecast, and retrieves only a specific area. + optionally the header "Issued by the Met Office at ****.

WARNING NOT TO BE USED FOR NAVIGATION. this is a gimmick and no substitute for a Properly sourced forecast. it may expire if any of several servers expire. Use for interest only. Also actually using it on a public site may be illegal I can find no sign saying you may not republish the shipping Forecast, it used to be a public service that bitch Maggie( small m please take offense) probably privatized it. Am still annoyed about the unavailability of Brighton Tide Harmonics for the same reason!

Description

 

get_forecast ( string sea area, int header, string format)

 

This is a PHP function that loads the shipping forecast from http://iwin.nws.noaa.gov retrieves the currently published forecast for the are supplied, with or with out the intro and issue time (Issued by the Met office at "time" "date"). In 3 formats HTML (just p and br tags), text (unix linefeed) or as a string (no linefeeds).

Parameter List

 

area

the forecast area you interested in in my case I put in "Dover". case insensitive (I hope).

 

header

 

Do you want the intro I strongly suggest you do, so you can tell its a current forecast that's being displayed. 0 (zero) for intro 1 for an intro

 

format

Format, stick in one of the following:

  • "text" nice dull text with unix line feed character (slash n).
  • "html" a paragraph of HTML with HTML linefeed markers (br)
  • "string" Dull boring no line feed text for further processing
    Return Values

     

    Returns nice paragraph or string similar to:
    THE SHIPPING FORECAST ISSUED BY THE MET OFFICE AT 1725 ON SATURDAY 05 FEBRUARY 2005
    DOVER WIGHT PORTLAND SOUTH BACKING SOUTHEAST 3 OR 4, OCCASIONALLY 5. RAIN AT TIMES. MODERATE OR GOOD

    Example 1. get_forecast() example

     

      echo get_forecast(Malin, 1, html);

     

    The above will output:

     

    THE SHIPPING FORECAST ISSUED BY THE MET OFFICE AT 1725 ON SATURDAY 05 FEBRUARY 2005

     

    SHANNON ROCKALL MALIN HEBRIDES NORTH 6 TO GALE 8, VEERING NORTHEAST 4 OR 5, OCCASIONALLY 6, BUT SOUTH OR SOUTHEAST IN NORTH ROCKALL AND HEBRIDES. SHOWERS. MODERATE OR GOOD

    CODE:

    function

  • [Printable]
    Share

    Shipping Forcast Parser

    Posted: Sun 6th February 2005 in Blog

    Shipping Forcast Parser

    Parses the Shipping Forecast, and retrieves only a specific area. + optionally the header "Issued by the Met Office at ****.

    WARNING NOT TO BE USED FOR NAVIGATION. this is a gimmick and no substitute for a Properly sourced forecast. it may expire if any of several servers expire. Use for interest only. Also actually using it on a public site may be illegal I can find no sign saying you may not republish the shipping Forecast, it used to be a public service that bitch Maggie( small m please take offense) probably privatized it. Am still annoyed about the unavailability of Brighton Tide Harmonics for the same reason!

    Description

     

    get_forecast ( string sea area, int header, string format)

     

    This is a PHP function that loads the shipping forecast from http://iwin.nws.noaa.gov retrieves the currently published forecast for the are supplied, with or with out the intro and issue time (Issued by the Met office at "time" "date"). In 3 formats HTML (just p and br tags), text (unix linefeed) or as a string (no linefeeds).

    Parameter List

     

    area

    the forecast area you interested in in my case I put in "Dover". case insensitive (I hope).

     

    header

     

    Do you want the intro I strongly suggest you do, so you can tell its a current forecast that's being displayed. 0 (zero) for intro 1 for an intro

     

    format

    Format, stick in one of the following:

  • "text" nice dull text with unix line feed character (slash n).
  • "html" a paragraph of HTML with HTML linefeed markers (br)
  • "string" Dull boring no line feed text for further processing
    Return Values

     

    Returns nice paragraph or string similar to:
    THE SHIPPING FORECAST ISSUED BY THE MET OFFICE AT 1725 ON SATURDAY 05 FEBRUARY 2005
    DOVER WIGHT PORTLAND SOUTH BACKING SOUTHEAST 3 OR 4, OCCASIONALLY 5. RAIN AT TIMES. MODERATE OR GOOD

    Example 1. get_forecast() example

     

      echo get_forecast(Malin, 1, html);

     

    The above will output:

     

    THE SHIPPING FORECAST ISSUED BY THE MET OFFICE AT 1725 ON SATURDAY 05 FEBRUARY 2005

     

    SHANNON ROCKALL MALIN HEBRIDES NORTH 6 TO GALE 8, VEERING NORTHEAST 4 OR 5, OCCASIONALLY 6, BUT SOUTH OR SOUTHEAST IN NORTH ROCKALL AND HEBRIDES. SHOWERS. MODERATE OR GOOD

    CODE:

    function

  •