The example in this article describes how to randomly obtain a daily sentence from Kingsoft PowerWord in PHP. Share it with everyone for your reference. The specific implementation method is as follows:
-
- header('Content-Type: text/html; charset=utf-8');
- $nowyear=date("Y");
- $nowmouth = date('m');
- $nowday = date('d');
- $date = mt_rand("2012",$nowyear)."-".mt_rand("1",$nowmouth)."-".mt_rand("1",$nowday);
- $content=file_get_contents('http://open.iciba.com/dsapi/?date='.$date);
- $arr=json_decode($content,true);
- print_r($arr);
-
-
Copy code
I hope this article will be helpful to everyone’s PHP programming design.
|