zoukankan      html  css  js  c++  java
  • PHP获取网页返回的JSON数据并在微信换行展示

     1           $url ="http://japi.juhe.cn/joke/content/text.from?page=&pagesize=&key=c968d04ab0ea15e8f480b6c2d534804f";
     2                 $handle = fopen($url,"rb");
     3                 $content = "";
     4                 while (!feof($handle)) {
     5                 $content .= fread($handle, 600);
     6                 }
     7                 fclose($handle);
     8                 $content = json_decode($content)->data;;
     9                 $ime = "IMEI:".$content->imei."
    ";
    10                 $sn = "序列号:".$content->sn."
    ";
    11                 $model = "设备名称:".$content->model."
    ";
    12                 $capacity = "设备容量:".$content->capacity."
    ";
    13                 $color = "设备颜色:".$content->color."
    ";
    14                 $number = $content->number;
    15                 $identifier = $content->identifier;
    16                 $network = $content->network;
    17                 $activated = $content->activated;
    18                 if($activated){
    19                     $activated = "
    是否激活:已激活
    ";
    20                 }else{
    21                     $activated = "
    是否激活:未激活
    ";
    22                 }
    23                 $purchase = "激活日期:".$content->purchase->date."
    ";
    24                 $coverage = "保修状态:".$content->coverage."到期,";
    25                 $daysleft = "剩余:".$content->daysleft."天
    ";
    26                 $support = $content->support;
    27                 if($support=="expired"){
    28                     $support="电话支持:已过期
    ";
    29                 }else{
    30                     $support="电话支持:".$support."到期
    ";
    31                 }
    32                 $applecare = $content->applecare;
    33                 if($applecare){
    34                     $applecare = "是否官换机:是";
    35                 }else{
    36                     $applecare = "是否官换机:否";
    37                 }
    38                 $product = $content->product;
    39                 $start = $content->production->start;
    40                 $end = $content->production->end;
    41                 $origin = $content->production->origin;
    42             
    43                 $weObj->text ("查询结果:
    ".$sn.$ime.$model.$color.$capacity.$activated.$purchase.$coverage.$daysleft.$support.$applecare)->reply ();
    44                 exit;
    45                 }
  • 相关阅读:
    一个好的时间函数
    Codeforces 785E. Anton and Permutation
    Codeforces 785 D. Anton and School
    Codeforces 510 E. Fox And Dinner
    Codeforces 242 E. XOR on Segment
    Codeforces 629 E. Famil Door and Roads
    Codeforces 600E. Lomsat gelral(Dsu on tree学习)
    Codeforces 438D The Child and Sequence
    Codeforces 729E Subordinates
    【ATcoder】D
  • 原文地址:https://www.cnblogs.com/jeib/p/6879904.html
Copyright © 2011-2022 走看看