johnnymck/shippingforecast
Composer 安装命令:
composer require johnnymck/shippingforecast
包简介
Shipping Forecast scraping library, pulling data from the BBC's shipping forecast page. Based on tnm/shipping-forecast
README 文档
README
A straight-forward shipping forecast API written in pure PHP which scrapes up-to-date info from the BBC shipping forecast webpage.
Source based on Ted Nyman's shipping forecast project. Mega props to that guy! :)
Installation
composer install johnnymck/shippingforecast
Usage
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'...
It's worth noting that ShippingForecast::get($foo) and ShippingForecast::getAll() both yeild an assoc array containing ['time'], the time as a string when last updated by the BBC, and ['content'] which contains the forecast-proper, including a ['warning'] array to yeild any prevalent warning information. See examples/ for further information.
Fun Stuff!
Running php readforecast.php in the root of the application and piping the output into a text-to-speech application (such as say on Macintosh) will read the latest forecast update without you having to bother tuning your wireless sets to BBC R4, 3 times a day. What a time to be alive!
./forecast [Capitalised zone name here] will return the forecast in plaintext in your desired zone
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2018-07-28