���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/trader/vendor/zaloplatform/zalo-php-sdk/src/HttpClients/ |
<?php /** * Zalo © 2019 * */ namespace Zalo\HttpClients; use Zalo\Http\GraphRawResponse; use Zalo\Exceptions\ZaloSDKException; use Zalo\HttpClients\ZaloHttpClientInterface; /** * Class ZaloStreamHttpClient * * @package Zalo */ class ZaloStreamHttpClient implements ZaloHttpClientInterface { /** * @var ZaloStream Procedural stream wrapper as object. */ protected $zaloStream; /** * @param ZaloStream|null Procedural stream wrapper as object. */ public function __construct(ZaloStream $zaloStream = null) { $this->zaloStream = $zaloStream ?: new ZaloStream(); } /** * @inheritdoc */ public function send($url, $method, $body, array $headers, $timeOut) { $options = [ 'http' => [ 'method' => $method, 'header' => $this->compileHeader($headers), 'content' => $body, 'timeout' => $timeOut, 'ignore_errors' => true ], 'ssl' => [ 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => true, // All root certificates are self-signed 'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem', ], ]; $this->zaloStream->streamContextCreate($options); $rawBody = $this->zaloStream->fileGetContents($url); $rawHeaders = $this->zaloStream->getResponseHeaders(); if ($rawBody === false || empty($rawHeaders)) { throw new ZaloSDKException('Stream returned an empty response', 660); } $rawHeaders = implode("\r\n", $rawHeaders); return new GraphRawResponse($rawHeaders, $rawBody); } /** * Formats the headers for use in the stream wrapper. * * @param array $headers The request headers. * * @return string */ public function compileHeader(array $headers) { $header = []; foreach ($headers as $k => $v) { $header[] = $k . ': ' . $v; } return implode("\r\n", $header); } }