您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何实现PHP抓取天气预报的功能_PHP教程

2024/6/23 11:52:08发布42次查看
我们可以使用
php抓取天气预报绝对精简代码
form method=post>  input name=a type=text id=a />  input type=submit name=submit value=查 />  form>   ?php   $city = $_request[a];   if ($city==)   {   $city=菏泽;   }   $url = 'http://www.baidu.com/s?wd='.$city.'天气';    $lines_array = file($url);    $lines_string = implode('', $lines_array);    eregi(今天((.*)今日气象指数, $lines_string, $body);    $body[0]=strip_tags($body[0]);   $body[0] = str_replace( 今日气象指数,,$body[0]);   $body[0] = str_replace( ,,$body[0]);   echo $city.$body[0];   ?> 以上代码示例就是php抓取天气预报的实现方法。
http://www.bkjia.com/phpjc/446178.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/446178.htmltecharticle我们可以使用 php抓取天气预报绝对精简代码 form method = post input name = a type = text id = a / input type = submit name = submit value = 查 / / form ?php $ city...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product