PHP code example of johnnymck / shippingforecast

1. Go to this page and download the library: Download johnnymck/shippingforecast library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

johnnymck / shippingforecast example snippets


use ShippingForecast\ShippingForecast;

$forecast = new ShippingForecast();
$cromarty = $forecast->get('Cromarty'); // location names must be capitalised

echo $cromarty['time']; // eg,  'The general synopsis at 1800'...
print_r($cromarty['content']['warning']); // returns array of warnings (often empty, though not in wintertime 😅)
echo $cromarty['content']['visibility']; // eg, 'Good, occasionally poor'...