unikent/curl
Composer 安装命令:
composer require unikent/curl
包简介
Laravel Curl Helper Library.
README 文档
README
Laravel-cURL is a library born out of Codeigniter-cURL by Phil[http://philsturgeon.co.uk/code/codeigniter-curl] which makes it easy to do simple cURL requests and makes more complicated cURL requests easier too.
Requirements
- PHP 5.1+
- Laravel 3
- PHP 5 (configured with cURL enabled)
- libcurl
Features
- POST/GET/PUT/DELETE requests over HTTP
- HTTP Authentication
- Follows redirects
- Returns error string
- Provides debug information
- Proxy support
- Cookies
Download
https://github.com/mogetutu/laravel-curl
Examples
$this->curl = New Curl;
Simple calls
These do it all in one line of code to make life easy. They return the body of the page, or FALSE on fail.
// Simple call to remote URL
echo $this->curl->simple_get('http://example.com/');
// Simple call to CI URI
$this->curl->simple_post('controller/method', array('foo'=>'bar'));
// Set advanced options in simple calls
// Can use any of these flags http://uk3.php.net/manual/en/function.curl-setopt.php
$this->curl->simple_get('http://example.com', array(CURLOPT_PORT => 8080));
$this->curl->simple_post('http://example.com', array('foo'=>'bar'), array(CURLOPT_BUFFERSIZE => 10));
Advanced calls
These methods allow you to build a more complex request.
// Start session (also wipes existing/previous sessions)
$this->curl->create('http://example.com/');
// Option & Options
$this->curl->option(CURLOPT_BUFFERSIZE, 10);
$this->curl->options(array(CURLOPT_BUFFERSIZE => 10));
// More human looking options
$this->curl->option('buffersize', 10);
// Login to HTTP user authentication
$this->curl->http_login('username', 'password');
// Post - If you do not use post, it will just run a GET request
$post = array('foo'=>'bar');
$this->curl->post($post);
// Cookies - If you do not use post, it will just run a GET request
$vars = array('foo'=>'bar');
$this->curl->set_cookies($vars);
// Proxy - Request the page through a proxy server
// Port is optional, defaults to 80
$this->curl->proxy('http://example.com', 1080);
$this->curl->proxy('http://example.com');
// Proxy login
$this->curl->proxy_login('username', 'password');
// Execute - returns responce
echo $this->curl->execute();
// Debug data ------------------------------------------------
// Errors
$this->curl->error_code; // int
$this->curl->error_string;
// Information
$this->curl->info; // array
unikent/curl 适用场景与选型建议
unikent/curl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42.77k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2013 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「curl」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 unikent/curl 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 unikent/curl 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 unikent/curl 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
cURL and cURL based Soap-Client for PHP
Simple cURL wrapper
A fluent PHP CURL wrapper
Build mini web servers in PHP for testing
Alfabank REST API integration
Async Curl using React\ChildProcess
统计信息
- 总下载量: 42.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-03-04