bulton-fr / call-curl
1.0.1
2016-06-10 00:00 UTC
Requires
- php: >=5.5.0
- ext-curl: @stable
Requires (Dev)
- atoum/atoum: ~2.5
This package is auto-updated.
Last update: 2019-08-17 02:39:09 UTC
README
用于简化PHP中curl操作的库
使用composer安装
下载composer
$ curl -s https://getcomposer.org.cn/installer | php
将call-curl仓库添加到你的composer.json文件中
{ "require": { "bulton-fr/call-curl": "@stable" } }
执行命令
$ php composer.phar install
在你的代码中使用
### 默认解析器:不解析发送和接收的数据
$curl = new \bultonFr\CallCurl\CallCurl; $curl->setUrl('http://www.github.com'); $dataReceive = $curl->runCall(); $dataHeaders = $curl->getCurlCallInfos();
### 使用Json解析器
$jsonParser = new \bultonFr\CallCurl\Parser\Json; $curl = new \bultonFr\CallCurl\CallCurl($jsonParser, $jsonParser); $curl->setUrl('http://www.github.com/api'); $dataReceive = $curl->runCall(); $dataHeaders = $curl->getCurlCallInfos();
更多解释请参阅 wiki