GithubHelp home page GithubHelp logo

classinapi / classin-api Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 1.0 9 KB

classin-api-sdk-php 是为了让PHP开发者能够在自己的代码里更快捷方便的使用 ClassIn 的 API 而开发的 SDK 工具包。

Home Page: https://www.schooin.com

PHP 100.00%

classin-api's Introduction

classin-api-sdk-php

classin-api-sdk-php 是为了让PHP开发者能够在自己的代码里更快捷方便的使用 ClassIn 的 API 而开发的 SDK 工具包。

入门

  1. 申请安全认证。在第一次使用 API 之前,用户首先需要在 eeo.cn 网站上申请机构认证 API 密钥,密钥包含 SID 和 SECRET,SID 是用于标识调用者机构身份,SECRET 是用于服务器端验证签名字符串的密钥。SID 和 SECRET 需要严格保管,避免泄露。

  2. 使用方法请参考下面的例子。

先安装 composer require classin-api/classin-api

云盘资源请求

<?php
use ClassInApi\Module\Cloud as ClassInCloudApi;

$config = array(
    'sid' => getenv('CLASSINAPI_SID'), //'您的 SID',
    'secret' => getenv('CLASSINAPI_SECRET'), //'您的 SECRET'
);


$classincloudapi = new ClassInCloudApi($config);
// 请求参数,请参考官方 API 文档上对应接口的说明
// 请求前可以通过下面四个方法重新设置请求的 SID/SECRET参数
// 请求方法对应api 文档 action值

// 重新设置 SID
$sid = '您的 SID';
$classincloudapi->setConfigSid($sid);

// 重新设置 SECRET
$secret = '您的 SECRET';
$classincloudapi->setConfigSecret($secret);

// 重新设置 ServerHost
$server_host = '您的 ClassinApi ServerHost';
$classincloudapi->setServerHost($server_host);

$res = $classincloudapi->getCloudList([
    'folderId' => 0
]);

var_dump($res);

课程列表请求

<?php
use ClassInApi\Module\Course as ClassInCourseApi;

$config = array(
    'sid' => getenv('CLASSINAPI_SID'), //'您的 SID',
    'secret' => getenv('CLASSINAPI_SECRET'), //'您的 SECRET'
);

$classincourseapi = new ClassInCourseApi($config);
// 请求参数,请参考官方 API 文档上对应接口的说明
// 请求前可以通过下面四个方法重新设置请求的 SID/SECRET参数
// 请求方法对应api 文档 action值

// 重新设置 SID
$sid = '您的 SID';
$classincourseapi->setConfigSid($sid);

// 重新设置 SECRET
$secret = '您的 SECRET';
$classincourseapi->setConfigSecret($secret);

// 重新设置 ServerHost
$server_host = '您的 ClassinApi ServerHost';
$classincourseapi->setServerHost($server_host);

$res = $classincourseapi->getCourseList();

var_dump($res);

classin-api's People

Contributors

fengye2419 avatar classinapi avatar

Stargazers

 avatar lkyu avatar qcdcool avatar ChangsongLi avatar gradydong avatar  avatar

Forkers

gradydong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.