數據形式的網站,我有以下網站: http://stationmeteo.meteorologic.net/metar/your-metar.php?icao=LFRS&day=070308提取使用PHP
我想從中提取數據。 我嘗試使用file_get_contents和一些正則表達式,但有些不起作用。
這是我試過的代碼:它給我不確定的偏移量爲0和1 如果我直接複製網頁的內容,$內容,而不是使用的file_get_contents的
$content=file_get_contents('http://stationmeteo.meteorologic.net/metar/your-metar.php? icao=LFMN&day=010513');
preg_match('/00\:30 07\/03\/2008(.+)01\:30 07\/03\/2008/',$content,$m);
echo $m[0];
echo $m[1];
,它工作正常。
我錯過了什麼?
當你使用'file_get_contents(...)',你有什麼獲得$內容? – dreamweiver
因爲沒有匹配'00:00 01/05/2013'的時間戳,你沒有找到匹配項? – h2ooooooo
對不起,我把日期設置錯了我的意思是,00:30 07/03/2008和01:30 07/03/2008 – maggiemh