PHP code example of randomhost / weather

1. Go to this page and download the library: Download randomhost/weather 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/ */

    

randomhost / weather example snippets



namespace randomhost\Weather;

nce
$feed = new Yahoo\Feed('Cologne', Yahoo\Feed::UNITS_INTL);

echo sprintf(
    'Temperature: %s°%s, Humidity: %s%%',
    $feed->getCondition()->getTemperature(),
    $feed->getUnits()->getTemperature(),
    $feed->getAtmosphere()->getHumidity()
);