阅读132 返回首页    go Php编程


MultiHttp:高性能的 PHP 封装的 HTTP Restful 多线程并发请求库

MultiHttp

This is high performance curl wrapper written in pure PHP. It s compatible with PHP 5.4+ and HHVM. Notice that libcurl version must be over 7.36.0, otherwise timeout can not suppert decimal.

这是一个高性能的PHP封装的HTTP Restful多线程并发请求库,参考借鉴了httpresful 、multirequest等优秀的代码。它与PHP 5.4和hhvm兼容。 注意,libcurl版本必须>=7.36.0,否则超时不支持小数。

Contents

Feature

Installation

Usage

Single-request

Multi-request

Documentation

Request

MultiRequest

Feature

alias of curl option, e.g. timeout equals CURLOPT_TIMEOUT etc.

Request and MultiRequest class , can be used in any combination

graceful and efficient

Installation

You can use composer to install this library from the command line.

composerrequiresinacms/multihttpUsageSingle-request:

DocumentationRequestoption shorthand

url => CURLOPT_URL , debug => CURLOPT_VERBOSE ,//for debug verbose method => CURLOPT_CUSTOMREQUEST , data => CURLOPT_POSTFIELDS ,// array or string , file begin with @ ua => CURLOPT_USERAGENT , timeout => CURLOPT_TIMEOUT ,// (secs) 0 means indefinitely connect_timeout => CURLOPT_CONNECTTIMEOUT , referer => CURLOPT_REFERER , binary => CURLOPT_BINARYTRANSFER , port => CURLOPT_PORT , header => CURLOPT_HEADER ,// TRUE:include header headers => CURLOPT_HTTPHEADER ,// array download => CURLOPT_FILE ,// writing file stream (using fopen()), default is STDOUT upload => CURLOPT_INFILE ,// reading file stream transfer => CURLOPT_RETURNTRANSFER ,// TRUE:return string; FALSE:output directly (curl_exec) follow_location => CURLOPT_FOLLOWLOCATION , timeout_ms => CURLOPT_TIMEOUT_MS ,// milliseconds, libcurl version > 7.36.0 ,

public static function create()

public function endCallback()

public function hasEndCallback()

public function onEnd(callable$callback)

public function uri

public function getIni($field)

public function addQuery($data)

public function post($uri, array $payload = array(), array $options = array())

public function addOptions(array $options = array())

public function get($uri, array $options = array())

public function send()

public function applyOptions()

public function makeResponse($isMultiCurl = false)

MultiRequest

public static function create()

public function addOptions(array $URLOptions)

public function add($method, $uri, array $payload = array(), array $options = array())

public function import(Request $request)

public function sendAll()

[More] https://github.com/sinacms/MultiHttp/blob/master/usage.md

最后更新:2017-10-09 02:15:06

  上一篇:go PHP SPL的常用数据结构
  下一篇:go 药店营业员、文案策划、PHP程序员、平面设计等职位招聘,程序员、餐饮管理等职位求职