/** * * * @param \Phergie\Irc\Plugin\React\Command\CommandEvent $event * @param \Phergie\Irc\Bot\React\EventQueueInterface $queue */ public function queryExpress(Event $event, Queue $queue) { $number = $event->getCustomParams()[0]; if ($number && is_numeric($number)) { $query = new Kuaidi($number); $result = json_decode($query->quick_query(), true); $queue->ircPrivmsg($event->getSource(), 'Query Result: '); for ($i = 0; $i < $this->lines; $i++) { if (@isset($result['data'][$i])) { $msg = $result['data'][$i]['time'] . ' -- ' . $result['data'][$i]['context']; $queue->ircPrivmsg($event->getSource(), $msg); } } } else { $queue->ircPrivmsg($event->getSource(), "Param missing or incorrect! Express ID should be numeric."); } }
<?php header("content-type: text/html; charset=utf-8"); include 'kuaidi.class.php'; if (@$_REQUEST['com']) { $com = @$_REQUEST['com'] ? $_REQUEST['com'] : 0; $num = @$_REQUEST['num'] ? $_REQUEST['num'] : 0; $query = new Kuaidi($num); echo $query->query_num($com); } else { $num = @$_REQUEST['num'] ? $_REQUEST['num'] : 0; if ($num) { $query = new Kuaidi($num); echo $query->quick_query(); } else { echo "No input."; } }