![]() |
Bearsampp 2026.7.11
|
Static Public Member Functions | |
| static | checkInternetState () |
| static | getApiJson ($url) |
| static | getChangelogUrl ($utmSource=true) |
| static | getCurlHttpHeaders ($url) |
| static | getFopenHttpHeaders ($url) |
| static | getGithubUrl ($type='user', $user=APP_GITHUB_USER, $repo=null, $branch=null, $path=null) |
| static | getGithubUserUrl () |
| static | getHeaders ($host, $port, $ssl=false) |
| static | getHttpHeaders ($pingUrl) |
| static | getLatestVersion ($url) |
| static | getRemoteFilesize ($url, $humanFileSize=true) |
| static | getWebsiteUrl ($path='', $fragment='', $utmSource=true) |
| static | getWebsiteUrlNoUtm ($path='', $fragment='') |
| static | setupCurlHeaderWithToken () |
Definition at line 19 of file class.httpclient.php.
|
static |
Checks the current state of the internet connection.
This method attempts to reach a well-known website (e.g., www.google.com) to determine the state of the internet connection. It returns true if the connection is successful, otherwise it returns false.
Definition at line 409 of file class.httpclient.php.
Referenced by QuickPick\getQuickpickMenu(), and QuickPick\installModule().
|
static |
Sends a GET request to the specified URL and returns the response.
| string | $url | The URL to send the GET request to. |
Definition at line 298 of file class.httpclient.php.
References Log\error(), and setupCurlHeaderWithToken().
Referenced by getLatestVersion().
|
static |
Constructs the URL to the changelog page, optionally including UTM parameters.
| bool | $utmSource | Whether to include UTM source parameters. |
Definition at line 172 of file class.httpclient.php.
References getWebsiteUrl().
|
static |
Retrieves HTTP headers from a given URL using cURL.
This method initializes a cURL session, sets various options to fetch headers including disabling SSL peer verification, and executes the request. It logs the raw response for debugging purposes and parses the headers from the response.
| string | $url | The URL from which to fetch the headers. |
Definition at line 99 of file class.httpclient.php.
References $response, $result, and Log\trace().
Referenced by getHttpHeaders().
|
static |
Retrieves HTTP headers from a given URL using the fopen function.
This method creates a stream context to disable SSL peer and peer name verification, which allows self-signed certificates. It attempts to open the URL and read the HTTP response headers.
| string | $url | The URL from which to fetch the headers. |
Definition at line 66 of file class.httpclient.php.
References $result.
Referenced by getHttpHeaders().
|
static |
Generates various GitHub URLs based on the specified type.
| string | $type | The type of URL ('user', 'repo', 'raw'). Defaults to 'user'. |
| string | $user | The GitHub username. Defaults to 'Bearsampp'. |
| string | null | $repo | The repository name (required for 'repo' and 'raw' types). |
| string | null | $branch | The branch name (required for 'raw' type). |
| string | null | $path | The file path (required for 'raw' type). |
Definition at line 187 of file class.httpclient.php.
References APP_GITHUB_USER.
Referenced by getGithubUserUrl().
|
static |
Gets the GitHub user URL for Bearsampp.
Definition at line 236 of file class.httpclient.php.
References APP_GITHUB_USER, and getGithubUrl().
Referenced by ActionAbout\__construct(), and ActionAbout\processWindow().
|
static |
Retrieves the initial response line from a specified host and port using a socket connection.
This method optionally uses SSL and creates a stream context similar to getFopenHttpHeaders. It attempts to connect to the host and port, reads the first line of the response, and parses it. Detailed debug information is logged for each header line received.
| string | $host | The host name or IP address to connect to. |
| int | $port | The port number to connect to. |
| bool | $ssl | Whether to use SSL (defaults to false). |
Definition at line 254 of file class.httpclient.php.
References $port, $result, and Log\debug().
Referenced by BinMailpit\checkPort(), and BinXlight\checkPort().
|
static |
Retrieves HTTP headers from a given URL using either cURL or fopen, depending on availability.
| string | $pingUrl | The URL to ping for headers. |
Definition at line 28 of file class.httpclient.php.
References $result, Log\debug(), getCurlHttpHeaders(), and getFopenHttpHeaders().
Referenced by BinApache\checkPort().
|
static |
Fetches the latest version information from a given url.
| string | $url | The URL to fetch version information from. |
Definition at line 336 of file class.httpclient.php.
References $result, Log\debug(), Log\error(), and getApiJson().
Referenced by ActionCheckVersion\__construct(), and ActionCheckVersion\processWindow().
|
static |
Retrieves the file size of a remote file.
| string | $url | The URL of the remote file. |
| bool | $humanFileSize | Whether to return the size in a human-readable format. |
Definition at line 389 of file class.httpclient.php.
References Util\humanFileSize().
|
static |
Constructs a complete website URL with optional path, fragment, and UTM source parameters.
| string | $path | Optional path to append to the base URL. |
| string | $fragment | Optional fragment to append to the URL. |
| bool | $utmSource | Whether to include UTM source parameters. Defaults to true. |
Definition at line 134 of file class.httpclient.php.
References $bearsamppCore, and APP_WEBSITE.
Referenced by getChangelogUrl(), TplAppApache\getMenuApache(), TplAppMailpit\getMenuMailpit(), TplAppMariadb\getMenuMariadb(), TplAppMemcached\getMenuMemcached(), TplAppMysql\getMenuMysql(), TplAppNodejs\getMenuNodejs(), TplAppPhp\getMenuPhp(), TplAppPostgresql\getMenuPostgresql(), TplAppXlight\getMenuXlight(), QuickPick\getQuickpickMenu(), TplApp\getSectionMenuRight(), getWebsiteUrlNoUtm(), and ActionAbout\processWindow().
|
static |
Constructs a website URL without UTM parameters.
| string | $path | Optional path to append to the base URL. |
| string | $fragment | Optional fragment to append to the URL. |
Definition at line 160 of file class.httpclient.php.
References getWebsiteUrl().
Referenced by ActionAbout\__construct().
|
static |
Sets up cURL headers with token for API requests.
Definition at line 372 of file class.httpclient.php.
References APP_GITHUB_REPO, APP_GITHUB_USER, and APP_GITHUB_USERAGENT.
Referenced by getApiJson().