Bing壁纸API
2020-05-03 / CHINQ / / 2 min. read

必应壁纸 API

使用方法:
显示图片

<img src="https://wp.cqbg.ga/bing.php">

今日壁纸:

如何制作:
材料:

  • 一个装有 php 的服务器,需要有一个 ipv4 地址,最好有域名

制作方法:

  • 创建一个网站,使用 php

  • 将以下代码粘贴到 php 文件中

    
    <?php
      $str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1');
      $data = json_decode($str);
      $imghost = 'https://cn.bing.com';
      $imgpath = $data -> {'images'}[0] -> {'url'};
      if ($imgpath) {
          $imgurl = $imghost . $imgpath;
          header('Location:' . $imgurl);
          exit();
      } else {
          exit('error');
      }
    ?>
    
  • 然后访问就好了

Bing Wallpaper API

Instructions:
Image:

<img src="https://wp.cqbg.ga/bing.php">

How to make:
material:

  • A server with PHP needs an IPv4 address, preferably a domain name

Production Method:

  • Create a website using php
  • Paste the following code into the php file
    
    <?php
      $str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1');
      $data = json_decode($str);
      $imghost = 'https://cn.bing.com';
      $imgpath = $data -> {'images'}[0] -> {'url'};
      if ($imgpath) {
          $imgurl = $imghost . $imgpath;
          header('Location:' . $imgurl);
          exit();
      } else {
          exit('error');
      }
    ?>
    
  • Then just visit
😀
本文链接:
https://www.cqbg.ga/2020/05/03/Bing%E5%A3%81%E7%BA%B8API/