/bin binary Executable command
/sbin System Management commands, which are stored in the hypervisor used by the system administrator
/usr/bin a multitude of applications
/usr/sbin Some management programs for super users
<?php
$city = $argv [1];
$list = [' Shanghai ' = ' 101020100 ', ' beijing ' = ' 101010100 '];
$code = Isset ($list [$city])? $list [$city]: ' 101010100 ';
Initialization
$ch = Curl_init ();
Setting options, including URLs
$URL = "http://www.weather.com.cn/data/cityinfo/". $code. ". HTML ";
curl_setopt ($ch, Curlopt_url, $URL);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_header, 0);
Execute and get HTML document content
$output = curl_exec ($ch);
Releasing the curl handle
Curl_close ($ch);
Print the obtained data
$data = Json_decode ($output, true);
$GREEN = "\033[1;32m";
$DEFAULT = "\033[0;49m";
$BOLD = "\033[1m";
$UNDERLINE = "\033[4m";
$NORMAL = "\033[m";
$RED = "\033[1;31m";
echo $BOLD. ' Release time: '. $GREEN. $data [' Weatherinfo '] [' ptime ']. $DEFAULT;
echo "\ r \ n";
echo $BOLD. ' Maximum temperature: '. $GREEN. $data [' Weatherinfo '] [' Temp1 ']. $DEFAULT;
echo "\ r \ n";
echo $BOLD. ' Minimum temperature: '. $GREEN. $data [' Weatherinfo '] [' temp2 ']. $DEFAULT;
echo "\ r \ n"
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/84/05/wKioL1eDboDjgcAcAABOMxecajA127.jpg "style=" float: none; "title=" 11111111111.jpg "alt=" Wkiol1edbodjgcacaabomxecaja127.jpg "/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/84/05/wKioL1eDboCBYQUCAACqGvQTV5g465.jpg "style=" float: none; "title=" 22222222.jpg "alt=" Wkiol1edbocbyqucaacqgvqtv5g465.jpg "/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/84/06/wKiom1eDboDTE08VAADI1oyN7xo322.jpg "style=" float: none; "title=" 33333.jpg "alt=" Wkiom1edbodte08vaadi1oyn7xo322.jpg "/>
This article is from the "Old Cannon" blog, please be sure to keep this source http://joelemma.blog.51cto.com/11189330/1825493
Shell-View Weather