Home  >  Article  >  Backend Development  >  PHP的HTTP客户端:Httpful

PHP的HTTP客户端:Httpful

WBOY
WBOYOriginal
2016-06-20 12:52:381839browse

Httpful 是一个链式,REST友好的 PHP Http 客户端, cURL的一个健全替代。它的优点在强调可读性,简洁性、和灵活性,并提供基本的功能和灵活性帮助开发者完成工作,让功能易于实现。

特性:

  • 可读的 HTTP方法支持(GET, PUT, POST, DELETE, HEAD, PATCH 和 OPTIONS)

  • 可定制化的头文件

  • 自动“智能”解析

  • 自动负载系列化

  • 基本认证

  • 客户端证书验证

  • 请求“模板”

示例代码:

$url = "http://search.twitter.com/search.json?q=" . urlencode('#PHP');$response = Request::get($url)    ->withXTrivialHeader('Just as a demo')    ->send();     foreach ($response->body->results as $tweet) {    echo "@{$tweet->from_user} tweets \"{$tweet->text}\"\n";}

项目主页:http://www.open-open.com/lib/view/home/1437227778693

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn