mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 18:08:49 +03:00
v1.2.7.416
This commit is contained in:
parent
54e2645fcf
commit
3b27abbe9a
434 changed files with 51 additions and 72 deletions
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace KeenIO\Http\Adaptor;
|
||||
|
||||
/**
|
||||
* Class AdaptorInterface
|
||||
*
|
||||
* @package KeenIO\Http\Adaptor
|
||||
*/
|
||||
interface AdaptorInterface
|
||||
{
|
||||
/**
|
||||
* post to the KeenIO API
|
||||
*
|
||||
* @param $url
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function doPost($url, array $parameters);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace KeenIO\Http\Adaptor;
|
||||
|
||||
use Buzz\Browser;
|
||||
use Buzz\Client\Curl;
|
||||
|
||||
/**
|
||||
* Class Buzz
|
||||
* @package KeenIO\Http\Adaptor
|
||||
*/
|
||||
final class Buzz implements AdaptorInterface
|
||||
{
|
||||
|
||||
private $apiKey;
|
||||
private $browser;
|
||||
|
||||
/**
|
||||
* @param $apiKey
|
||||
* @param null $client
|
||||
*/
|
||||
public function __construct($apiKey)
|
||||
{
|
||||
$this->apiKey = $apiKey;
|
||||
$this->browser = new Browser(new Curl());
|
||||
$this->browser->getClient()->setVerifyPeer(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* post to the KeenIO API
|
||||
*
|
||||
* @param $url
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function doPost($url, array $parameters)
|
||||
{
|
||||
$headers = array(
|
||||
// 'Authorization' => $this->apiKey,
|
||||
'Content-Type' => 'application/json'
|
||||
);
|
||||
|
||||
$content = json_encode($parameters);
|
||||
|
||||
$response = $this->browser->post($url, $headers, $content);
|
||||
|
||||
return $response->getContent();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue