sincco/curl 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sincco/curl

Composer 安装命令:

composer require sincco/curl

包简介

Simple class for CURL implementation and DOM crawler

README 文档

README

Simple class for CURL implementation and DOM crawler

##Installation

To add this package as a local, per-project dependency to your project, simply add a dependency on your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on Debug:

{
    "require": {
        "sincco/curl": "dev-master"
    }
}

##Use

###Get string for a returned content

use Sincco\Tools\Curl;
$url = 'https://www.amazon.com.mx';
$curl = new \Sincco\Tools\Curl;
$curl->addOption(CURLOPT_CONNECTTIMEOUT, 100);
var_dump($curl->get($url));

###Navigate through DOM

use Sincco\Tools\Curl;
$url = 'https://www.amazon.com.mx';
$curl = new \Sincco\Tools\Curl;
$curl->addOption(CURLOPT_CONNECTTIMEOUT, 100);
$domPage = $curl->getDom($url);
foreach ($domPage->find('div[class=s-item-container] a[class=a-link-normal s-access-detail-page  a-text-normal]') as $item) {
	var_dump($item->href);
}

###Consume API

$urlBase = 'http://itron.mx/api/v1/'
$curl = new \Sincco\Tools\Curl;
$curl->addOption(CURLOPT_CONNECTTIMEOUT, 100);
$curl->setMethod('POST');
$params = ['email'=>'user@email.com', 'password'=>'password'];
$token = $curl->getJson($url . 'token', $params);
$curl->setAuthorization($token->token);
$curl->setMethod('GET');
var_dump($curl->getJson($url . 'contratos?filters[contrato]=999999'));
var_dump($curl->getJson($url . 'imagenes/contrato/999999'));

NOTICE OF LICENSE

This source file is subject to the Open Software License (OSL 3.0) that is available through the world-wide-web at this URL: http://opensource.org/licenses/osl-3.0.php

Happy coding!

统计信息

  • 总下载量: 524
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固