Download the PHP package lndj/lcrawl without Composer

On this page you can find all versions of the php package lndj/lcrawl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lcrawl

简介

Join the chat at https://gitter.im/lndj/Lcrawl

使用PHP实现正方教务系统爬虫功能。

可能是正方教务系统最优雅的一只爬虫。

安装

使用 composer 进行安装: composer require lndj/lcrawl

要体验最新功能,可以执行:

注意:请先安装 composer

Example

在请求过程中,你还可以设置 Referer/Timeoutheader 信息,直接采用链式调用即可。

会话缓存

在请求过程中,可以启用会话缓存功能,可以有效减少教务系统会话开启数量。

高级用法

为达到在登陆一次后的一段时间内,不需要再次执行登陆操作便可直接获取数据,减少教务网请求量,可以使用会话缓存。

首先,在实例化Lcrawl时,传入第三个参数为 true 。 例如:

第三个参数即表示开启会话缓存。

本项目使用 doctrine/cache 来完成缓存工作,它支持基本目前所有的缓存引擎。

在我们的 Lcrawl 中的所有缓存默认使用文件缓存,缓存路径取决于PHP的临时目录,如果你需要自定义缓存,那么你需要做如下的事情:

你可以参考doctrine/cache官方文档来替换掉应用中默认的缓存配置:

以 redis 为例

请先安装 redis 拓展:https://github.com/phpredis/phpredis

设置登录过程参数

本SDK默认使用的是 ysdx_default.aspx 为登陆的 uri 。若要使用其他 uri ,可自行抓包获取登录过程的参数。

在实例化时,传入第四个参数, $loginParam ,数组的key为固定值,value传入抓包过程中 POST body 的字段名即可。

API

getAll()

获取所有数据,并发获取

getSchedule()

获取课表数据

getGrade()

获取成绩数据

getCet()

获取四六级数据

getExam()

获取考试安排数据

setX()

设置相应 Header 值,例如: setUa()/setTimeout()/setReferer() 等。

getX()

Getter.

Laravel 中使用

在 Laravel 中框架使用 predis/predis ,那么我们就得使用 Doctrine\Common\Cache\PredisCache

上面提到的 app('redis')->connection($name) , 这里的 $namelaravel项目中配置文件 database.phpredis 配置名 defaulthttps://github.com/laravel/laravel/blob/master/config/database.php#L118 如果你使用的其它连接,对应传名称就好了。

License

MIT License


All versions of lcrawl with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
guzzlehttp/guzzle Version ~6.0
symfony/dom-crawler Version ^3.0
symfony/css-selector Version ^3.0
doctrine/cache Version ^1.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lndj/lcrawl contains the following files

Loading the files please wait ....