定制 curlphp/httpcurl 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

curlphp/httpcurl

Composer 安装命令:

composer require curlphp/httpcurl

包简介

PHP cURL library for server side request.

README 文档

README

cURL-PHP is a PHP library which makes it easy to do simple cURL requests and makes more complicated cURL requests easier too.

Requirements

  1. PHP 5.4+
  2. PHP 5 (configured with cURL enabled)
  3. libcurl

Features

  • POST/GET/PATHCH/PUT/DELETE requests over HTTP
  • HTTP Authentication
  • Follows redirects
  • Returns error string
  • Provides debug information
  • Proxy support
  • Cookies

API 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.

Hierachy of API object method calling may affect the functionality part.

These methods allow you to build a more complex request.

// import file
require 'curlphp/curlphp.php'

// Create an object
$curl = new curlphp();

// Option
$curl->setOption(CURLOPT_BUFFERSIZE, 10);
$curl->setOption(array(CURLOPT_BUFFERSIZE => 10));

// More human looking options
$curl->setOption('buffersize', 10);

// Headers
$curl->http_header('Content-Type','application/json');
$curl->http_header('Content-Length',300);

// SSL Option
$curl->setSSL(false);

// Login to HTTP user authentication
$curl->http_login('username', 'password');

// Cookies - If you do not use post, it will just run a GET request
$vars = array('foo'=>'bar');
$curl->set_cookies($vars);

// Proxy - Request the page through a proxy server
// Port is optional, defaults to 80
$curl->proxy('http://example.com', 1080);
$curl->proxy('http://example.com');

// Proxy login
$curl->proxy_login('username', 'password');

// Execute - returns responce
echo $curl->executeCurl();

// Debug data ------------------------------------------------
$curl->debug();

// Errors
$curl->error_code; // int
$curl->error_string;

// Information
$curl->info; // array

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固