Guzzle php resetful webservice farmework
13495 단어 webservice
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.github.com/user', [
'auth' => ['user', 'pass']
]);
echo $res->getStatusCode(); // 200
echo $res->getHeader('content-type'); // 'application/json; charset=utf8'
echo $res->getBody(); // {"type":"User"...'
var_export($res->json()); // Outputs the JSON decoded data
User guide
Overview
Requirements
Installation
License
Contributing
Reporting a security vulnerability
Quickstart
Make a Request
Using Responses
Query String Parameters
POST Requests
Cookies
Redirects
Exceptions
Clients
Creating a client
Sending Requests
Sending Requests in Parallel
Request Options
Event Subscribers
Environment Variables
Request and Response Messages
Headers
Body
Requests
Responses
Event System
Event Emitters
Event Priorities
Working With Request Events
Streams
Creating Streams
Metadata Streams
Stream Decorators
Adapters
Default Adapter
Creating an Adapter
Example Adapter
Testing Guzzle Clients
Mock Subscriber
History Subscriber
Mock Adapter
Test Web Server
FAQ
Why should I use Guzzle?
Is it possible to use Guzzle 3 and 4 in the same project?
How do I migrate from Guzzle 3 to 4?
What is this Maximum function nesting error?
Why am I getting a 417 error response?
How can I add custom cURL options?
How can I add custom stream context options?
HTTP Components
There are a number of optional libraries you can use along with Guzzle's HTTP layer to add capabilities to the client.
Log Subscriber
Logs HTTP requests and responses sent over the wire using customizable log message templates.
OAuth Subscriber
Signs requests using OAuth 1.0.
Progress Subscriber
Emits progress events when uploading and downloading data.
Cache Subscriber
Implements a private transparent proxy cache that caches HTTP responses.
Retry Subscriber
Retries failed requests using customizable retry strategies (e.g., retry based on response status code, cURL error codes, etc...)
Message Integrity Subscriber
Verifies the message integrity of HTTP responses using customizable validators. This plugin can be used, for example, to verify the Content-MD5 headers of responses.
Service Description Commands
You can use the Guzzle Command library to encapsulate interaction with a web service using command objects. Building on top of Guzzle's command abstraction allows you to easily implement things like service description that can be used to serialize requests and parse responses using a meta-description of a web service.
Guzzle Command
Provides the foundational elements used to build high-level, command based, web service clients with Guzzle.
Guzzle Services
Provides an implementation of the
Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
java가 클라이언트를 통해 서버 웹 서비스에 접근하는 방법본고는 자바가 클라이언트를 통해 서버 웹 서비스에 접근하는 방법을 실례로 설명한다.다음과 같이 여러분에게 참고할 수 있도록 공유합니다. 자바 관련 내용에 관심이 있는 더 많은 독자들은 본 사이트의 주제를 볼 수 있습...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.