mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-05 10:02:16 +09:00
Update several mail and SMS drivers to use HTTP class instead of Requests or raw curl
This commit is contained in:
parent
cf84d70ca1
commit
4f73c9562b
4 changed files with 25 additions and 41 deletions
|
|
@ -92,6 +92,7 @@ class Mailgun extends Base implements \Rhymix\Framework\Drivers\MailInterface
|
|||
$boundary = str_repeat('-', 24) . substr(md5(mt_rand()), 0, 16);
|
||||
$headers = array(
|
||||
'Content-Type' => 'multipart/form-data; boundary=' . $boundary,
|
||||
'User-Agent' => 'PHP',
|
||||
);
|
||||
$data = implode("\r\n", array(
|
||||
'--' . $boundary,
|
||||
|
|
@ -107,16 +108,15 @@ class Mailgun extends Base implements \Rhymix\Framework\Drivers\MailInterface
|
|||
'--' . $boundary . '--',
|
||||
'',
|
||||
));
|
||||
$options = array(
|
||||
$settings = array(
|
||||
'auth' => array('api', $this->_config['api_token']),
|
||||
'timeout' => 5,
|
||||
'useragent' => 'PHP',
|
||||
);
|
||||
|
||||
// Send the API request.
|
||||
$url = self::$_url . '/' . $this->_config['api_domain'] . '/messages.mime';
|
||||
$request = \Requests::post($url, $headers, $data, $options);
|
||||
$result = @json_decode($request->body);
|
||||
$request = \Rhymix\Framework\HTTP::post($url, $data, $headers, [], $settings);
|
||||
$result = @json_decode($request->getBody()->getContents());
|
||||
|
||||
// Parse the result.
|
||||
if (!$result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue