View file FreeWeatherInformers/index.php

File size: 1.63Kb
<?php

/*
 *       Copyright (C) W@P Labs Group
 *       Product name: Free Informers
 *        Web Site: http://waplabs.ru
 *       Web Site: http://x-engine.net
 *
 *  This script is redistributed to the free
 *     conditions, observe copyright and
 *    appreciate the work of programmers.
 *       Sincerely Michael aka Sklep
 *
 *  Founder of the project Michael aka Sklep
 *      (Jabber id: [email protected])
 */


ini_set('default_charset', 'uft-8');
header('Content-Type: text/html; charset=utf-8');

/**
 * Preload class queryApi()
 */
require_once('queryApi.php');

/**
 * Set the username and password
 */
queryApi::setAuth('demo', 'demo');

/**
 * Conclusion Weather for Moscow
 */
$ini = queryApi::send(array('API' => 'weather', 'Citi' => 'Москва'));

if ($ini->result == 'success') {
    echo '<img src="weather/' . $ini->answer->img . '" alt=""> ' . $ini->answer->city . ': ' .
    $ini->answer->high . '&deg;C | ' . $ini->answer->low . '&deg;C<br />' .
    $ini->answer->condition;
} else {
    echo 'Weather error: ' . $ini->error_text;
}

echo '<br /><br />';

/**
 * Conclusion Weather for Smolensk
 */
$ini = queryApi::send(array('API' => 'weather', 'Citi' => 'Смоленск'));

if ($ini->result == 'success') {
    echo '<img src="weather/' . $ini->answer->img . '" alt=""> ' . $ini->answer->city . ': ' .
    $ini->answer->high . '&deg;C | ' . $ini->answer->low . '&deg;C<br />' .
    $ini->answer->condition;
} else {
    echo 'Weather error: ' . $ini->error_text;
}

/**
 * 
 * View full response from the server so you can:
 * $ini = queryApi::send(array('API' => 'weather', 'Citi' => 'Москва'));
 * print_r($ini);
 *
 */
?>