コード例 #1
0
ファイル: hipchat.php プロジェクト: andrew-ayers/php
<?php

require_once __DIR__ . '/czar.php';
$czar = new czar();
$mention = "unknown";
if (!empty($GLOBALS['HTTP_RAW_POST_DATA'])) {
    $raw_post = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
}
if (!empty($raw_post->item->message->from)) {
    $mention = $raw_post->item->message->from->mention_name;
}
$luck_one = $czar->get_random();
$response = array('color' => 'green', 'message' => "Herro @" . $mention . ", you should travel " . $luck_one['time_from_office'] . "(" . $luck_one['distance_from_offce'] . ") to " . $luck_one['address'] . " and enjoy some " . $luck_one['name'] . " (yey)", 'notify' => false, 'message_format' => 'text');
header("Content-Type: Application/json");
echo json_encode($response);
コード例 #2
0
ファイル: choose.php プロジェクト: andrew-ayers/php
<?php

require_once __DIR__ . '/czar.php';
$czar = new czar();
echo "\f";
$food_places = $czar->get_places(true);
if (empty($food_places)) {
    die("There was an error loading food places (there weren't any found)\n");
}
echo "Loaded Information From:\r\n";
foreach ($food_places as $fp) {
    echo "\t" . $fp['name'] . "\r\n";
}
$lucky_one = $czar->get_random();
echo "\n\n\nThe lucky food place is!\n";
print_r($lucky_one);