Weather query citycode query interface, also available in sae

WBOY
Release: 2016-07-25 08:49:47
Original
1140 people have browsed it
Weather query citycode query interface will be used when using the National Weather Service weather forecast, you know.
                 
                                                                                                                                                                                                                                                                                                                  


function cityCode($cityName){
               
      $url = 'http://someapi.sinaapp.com/citycode/?city='.urlencode($cityName).'&encode=utf-8';
  1.  $ cityCode = file_get_contents($url);
  2. if($cityCode == '' || $cityCode == NULL){
  3. return NULL;
  4. }else{
  5. return $cityCode;
  6. }
  7. }
  8. Copy code
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template