Exemplo n.º 1
0
 /**
  * @vcr soap_weather_api_temperature
  */
 public function testGetTemperatureByZip()
 {
     $weatherApi = new WeatherApi();
     $actual = $weatherApi->getTemperature('10013');
     // somewhere in New York
     $this->assertInternalType('integer', $actual);
 }
Exemplo n.º 2
0
 /**
  * @todo Implement testGet_weather().
  */
 public function testGet_weather()
 {
     $weather = new WeatherApi();
     // ({start date}, {num days to recover})
     $weather->get_weather('2010-02-05', 2);
     $this->assertTrue(true);
 }
Exemplo n.º 3
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php 
require "./lib/WeatherApi.php";
require "./lib/Tweeter.php";
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$here = dirname(__FILE__);
set_include_path(ini_get('include_path') . ":{$here}/vendor/arc90-service-twitter/lib");
$weather = new WeatherApi();
// ({start date}, {num days to recover})
$weather->get_24h_periods('97214', strtotime('Tomorrow'), 2);
require_once 'Arc90/Service/Twitter.php';
$username = '******';
$password = '******';
$twitter = new Arc90_Service_Twitter($username, $password);
$timeline = $twitter->test('json');
$timeline = $twitter->updateStatus($weather->description(), 'json');
echo $timeline;
?>
    </body>
</html>
Exemplo n.º 4
0
<?php 
if ($argc) {
    if ($argc != 4 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
        ?>

    This script uses the SimpleWeatherAPI to retrieve a given number of 24h period
    summarized forecasts for a given zipcode.

      Usage:
      <?php 
        echo $argv[0];
        ?>
 <zipcode> <startdate> <number of days to retrieve>

      <zipcode> This is a US zipcode of 5 digits. ex: 97210
      <startdate> is in the form of Y-m-d. ex: 2010-02-05
      <number of days to retrieve> This is the number of days to retrieve.  It is
          inclusive of the startdate.

      With the --help, -help, -h, or -? options, you can get this help.
    <?php 
    } else {
        require dirname(__FILE__) . "/lib/WeatherApi.php";
        $zipcode = $argv[1];
        $start_date = strtotime($argv[2]);
        $days_to_collect = (int) $argv[3];
        $weather = new WeatherApi();
        echo "\nMaking call: get_24h_periods({$zipcode},{$start_date},{$days_to_collect})\n";
        $weather->get_24h_periods($zipcode, $start_date, $days_to_collect);
    }
}