kee2013 / eees-http
eees-http HTTP/1.1 client for php
This package's canonical repository appears to be gone and the package has been frozen as a result.
1.0.2
2017-08-15 17:13 UTC
Requires
- php: >=5.4
- etechnika/idna-convert: 1.0.*
This package is not auto-updated.
Last update: 2019-04-11 08:08:52 UTC
README
HTTP/1.1 Client for PHP
Installation
Via composer
Add the package to your composer.json
file:
{
"require": {
"Kee2013/eees-http": "1.0.*"
}
}
Run composer.phar update
.
Usage
The following example describes basic usage.
<?php
require_once('vendor/autoload.php');
use Eees\Http\Client as Client;
Client::ping('example.com', 30); //print 0.0.0.0
$http = Client::get('url', ['q' => 'value'], ['curl options']); //get request
//$http = Client::post('url', ['q' => 'value'], ['curl options']); //post request
//$http = Client::put('url', ['q' => 'value'], ['curl options']); //put request
//$http = Client::patch('url', ['q' => 'value'], ['curl options']); //patch request
//$http = Client::delete('url', ['q' => 'value'], ['curl options']); //delete request
//$http = Client::options('url'); //options request
//$http = Client::head('url'); //head request
var_dump($http->getInfo()); //print curl info array
var_dump($http->getRespone()); //print ['header' => ['respone header'], 'raw' => 'response text']
var_dump($http->format('json')); //support formatting json and xml
?>
v 1.0.3 更新
- 移除 Client::ping 方法
- 添加 Check::ping 方法
- 添加 Check::validateEmailAddr 方法, 校验邮箱地址有效性
use Eees\Http\Check;
Check::validateEmailAddr($email, $loop = false, $timeout = 30);
var_dump(Check::getMessage());
/**
print
array(2) {
'code' => int(200)
'message' => string(259) "
与服务器连接成功,服务器就绪:220 smtp.test.com Anti-spam GT for Coremail System (test-hosting[20140416])
与服务器HELO成功:250 OK
与服务器MAIL FROM成功:250 Mail OK
RCPT TO (test@test.com)验证成功: 250 Mail OK
"
}