We can use
PHP Crawl Weather forecast Absolute Lite Code
- < form method="POST">
- < input name="A" type="text" id="A" />
- < input type="Submit " name="Submit" value = "Check" />
- </ form >
- < ? PHP
- $ City = $_request["a"];
- if ($City= = "")
- {
- $ City = "Heze" ;
- }
- $ URL = ' http://www.baidu.com/s?wd= ' . $city. ' Weather ';
- $ Lines_array = file ($url);
- $ lines_string = implode (', $lines _array);
- Eregi (today's meteorological index, $lines _string, $body);
- $body [0]=strip_tags ($body [0]);
- $body [0] = Str_replace ("Today's Meteorological Index", "", $body [0]);
- $body [0] = Str_replace ("", "", $body [0]);
- echo $city. $body [0];
- ?>
The above code example is the implementation of the PHP crawl weather forecast.
http://www.bkjia.com/PHPjc/446178.html www.bkjia.com true http://www.bkjia.com/PHPjc/446178.html techarticle we can use PHP to crawl the weather forecast absolute Lite Code Form method = Post input name = a type = text id = a/input Type = Submit Name = Submit Value = check//form? PHP $ City ...