$city=$_GET['city'];
$city=str_replace(" ", "", $city);
// "http://www.weather-forecast.com/locations/".$city."/forecasts/latest" -> 網址
$content=file_get_contents("http://www.weather-forecast.com/locations/".$city."/forecasts/latest");
// \" -> " \/ -> / , s -> space , 正規表示法
preg_match("/<\/b><span class=\"read-more-small\"><span class=\"read-more-content\"> <span class=\"phrase\">(.*?)<\/span>/s", $content, $matches);
echo $matches[0];
沒有留言:
張貼留言