60秒读懂世界API接口源码

<?php
/**
 * Plugin Name: 60秒读懂世界
 * Author: 大米api
 * Author URL: https://api.qqsuu.cn/
 */

function callAPI($url, $params) {
  $queryString = http_build_query(array_filter($params));
  $requestURL = $url . '?' . $queryString;

  $options = array(
    'http' => array(
      'method' => 'GET',
      'header' => 'Content-type: application/x-www-form-urlencoded',
      'ignore_errors' => true
    )
  );

  $context = stream_context_create($options);
  $response = file_get_contents($requestURL, false, $context);

  if ($response === false) {
    // 请求失败
    echo "请求失败";
  } else {
    // 请求成功,输出响应内容
	if($params['type']=='json'){
		echo $response;
	}else{
		header("Content-Type:image/png"); 
		echo $response;
	}
    
  }
}

$url = 'https://api.qqsuu.cn/api/dm-60s?apiKey=bVd6b080ejhaMEpabG0yMmJCaWNYZz09';

$type = isset($_GET['type']) ? $_GET['type'] : '';

$params = array(
  'type' => $type
);

callAPI($url, $params);

保存为.PHP访问即可使用,输出 ?type=json

上一篇 华为Mate60系列,今日开售。 ​​​
下一篇 随机小姐姐视频源码更新
文章列表
1 Pixiv图片和用户获取信息接口源码
Pixiv图片和用户获取信息接口源码
2
IObit Uninstaller v10.1.0.22
IObit Uninstaller v10.1.0.22
3
打渔日历API接口
打渔日历API接口
4
521官宣超甜句子
521官宣超甜句子
5
WordPress5.3.2最新版本下载
WordPress5.3.2最新版本下载
大米酱

大米酱管理员

三百六十行,行行出BUG。

本月创作热力图

最新评论
2067608730
2067608730
4月11日
加油大米!quantou
评论于APINEXT