閱讀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程序員、平麵設計等職位招聘,程序員、餐飲管理等職位求職