Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 68 | All time: 10,335 This week: 673![]() |
Version | License | PHP version | Categories | |||
httpagent 1.0.0 | MIT/X Consortium ... | 5 | HTTP, PHP 5 |
Description | Author | |
This package provides an extensible HTTP client with a fluent interface. |
|
$browser = new Browser('http://192.168.123.171/', [
'request' => [
'headers' => [
'Accept' => 'application/json, text/javascript, /; q=0.01',
]
]
]);
$result = $browser->POST('/api/v1/auth/login'
, [ 'form_data'
=> [
'email' => 'naderi.payam@gmail.com',
'password' => '123456'
]
]
);
$result->expected(function(HttpResponse $httpResponse) use ($browser) {
$jsonResult = $httpResponse->plg()->json();
$authHeader = HeaderFactory::factory('Authorization', 'Bearer '.$jsonResult->token);
$browser->inOptions()->getRequest()->getHeaders()->set(
$authHeader
);
});
$browser->GET('/api/v1/users/me', null, [
'Accept' => 'application/json, text/javascript, /; q=0.01',
'X-Requested-With' => 'XMLHttpRequest',
'Referer' => 'http://localhost:8080/'
])->expected(function($response) {
$response->flush(false);
});
$request =
"GET /payam/ HTTP/1.1\r\n"
."Host: 95.211.189.240\r\n"
."User-Agent: AranRojan-PHP/5.5.9-1ubuntu4.11\r\n"
."Accept-Encoding: gzip\r\n"
."Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8\r\n"
."Cache-Control: no-cache"
;
$browser = new Browser('http://95.211.189.240/', ['connection' => ['allow_decoding' => false]]);
$res = $browser->request(new HttpRequest($request));
echo ($res->getRawBody()->read());
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.