-
-
Save cornguo/e357bade74728a63d7d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Taipei'); | |
$ch = curl_init('http://61.66.117.8/EmrCount/Default.aspx'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$data = curl_exec($ch); | |
$pattern = '/<td.*>.*<(font|span).*>(.*)<\/.*>/Uum'; | |
$match = array(); | |
preg_match_all($pattern, $data, $match); | |
$time = $match[2][5]; | |
$time = str_replace( | |
array('上', '下', '午'), | |
array('A', 'P', 'M'), | |
$match[2][10] | |
); | |
$time = explode(' ', $time); | |
$return = array( | |
'hospital_sn' => '1317050017', | |
'update_time' => strtotime($time[0] . ' ' . $time[2] . $time[1]), | |
'full_reported' => ('是' === $match[2][1])? true:false, | |
'pending_doctor' => intval($match[2][3]), | |
'pending_bed' => intval($match[2][5]), | |
'pending_ward' => intval($match[2][7]), | |
'pending_icu' => intval($match[2][9]) | |
); | |
echo json_encode($return); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
g0v/er.mohw#27
中國醫藥大學 網址改變
old http://61.66.117.8/EmrCount/Default.aspx
new http://61.66.117.28/EmrCount/Default.aspx