Skip to content

Commit 21ac985

Browse files
authored
Update README.md
1 parent f50231b commit 21ac985

File tree

1 file changed

+59
-18
lines changed

1 file changed

+59
-18
lines changed

README.md

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CheckHost PHP
22

3-
**CheckHost PHP** is a lightweight PHP wrapper for interacting with the [check-host.net](https://check-host.net) API, allowing you to run ping, HTTP, TCP, UDP, DNS, and traceroute checks from a variety of global nodes. It includes flexible country/node filtering and comprehensive result parsing.
3+
**CheckHost PHP** is a lightweight PHP wrapper for interacting with the [check-host.net](https://check-host.net) API, allowing you to run PING, HTTP, TCP, UDP, DNS, TRACEROUTE checks from a variety of global nodes. It includes flexible country/node filtering and comprehensive result parsing.
44

55
---
66

@@ -36,75 +36,116 @@ $checkHost = new \ILYAGVC\CheckHost\CheckHost(
3636

3737
### Parameters:
3838

39-
| Parameter | Type | Description |
40-
| -------------------- | ------------------------- | ----------------------------------------------------------------------------- |
41-
| `$selectedCountries` | `array`, `string`, `null` | List of countries (by name/code or node domain) to **include** or **exclude** |
42-
| `$except` | `bool` | If true, filters **exclude** the specified countries |
43-
| `$proxy` | `string` | Optional proxy for curl requests |
44-
| `$timeout` | `int` | Request timeout (seconds) for waiting on test results |
39+
| Parameter | Type | Description |
40+
| -------------------- | ------------------------- | --------------------------------------------------------------------------------------------------------- |
41+
| `$selectedCountries` | `array`, `string`, `null` | Country name(s), ISO country code(s), or node domain(s) to include/exclude (`null` = all available nodes) |
42+
| `$except` | `bool` | If `true`, excludes the specified countries instead of including them |
43+
| `$proxy` | `string` | Optional proxy for curl requests |
44+
| `$timeout` | `int` | Request timeout (seconds) for waiting on test results |
4545

4646
---
4747

4848
## 🔧 Methods
4949

5050
### `setCountry(array|string|null $countries, bool $except = false): bool`
5151

52-
Filters available nodes by countries. Returns `true` if nodes were successfully loaded.
52+
**Filters nodes based on country names, codes, or node domains.**
53+
54+
| Parameter | Type | Description |
55+
| ------------ | ------------------------- | --------------------------------------------------------------------------------------------------------- |
56+
| `$countries` | `array`, `string`, `null` | Country name(s), ISO country code(s), or node domain(s) to include/exclude (`null` = all available nodes) |
57+
| `$except` | `bool` | If `true`, excludes the specified countries instead of including them |
5358

5459
---
5560

5661
### `getNodes(): array`
5762

58-
Returns the currently filtered node list.
63+
**Returns the currently selected and filtered node list.**
64+
<br>
65+
*No parameters.*
5966

6067
---
6168

6269
### `getNodesIp(): array|false`
6370

64-
Fetches raw IP node list from `check-host.net`.
71+
**Fetches the raw IP list of all available nodes from check-host.net.**
72+
<br>
73+
*No parameters.*
6574

6675
---
6776

6877
### `updateNodes(): bool`
6978

70-
Refreshes node list using previous filters.
79+
**Refreshes and re-applies node filters to fetch the latest node list.**
80+
<br>
81+
*No parameters.*
7182

7283
---
7384

7485
### `sendRequest(string $host, string $type, int|null $maxNodes = 0): string|false`
7586

76-
Sends a check of a specified type (`ping`, `http`, etc.) for the given host.
77-
Returns a `request_id` to be used with `getResults`.
87+
**Sends a check request of a given type to selected nodes.**
88+
89+
| Parameter | Type | Description |
90+
| ----------- | -------- | ------------------------------------------------------------------------- |
91+
| `$host` | `string` | The target domain or IP to check |
92+
| `$type` | `string` | Type of check: one of `ping`, `http`, `tcp`, `udp`, `dns`, `traceroute` |
93+
| `$maxNodes` | `int` | Max number of nodes to use (`0` = all available nodes) |
7894

7995
---
8096

8197
### `getResults(string $requestId): array|false`
8298

83-
Fetches and parses the result for a previously submitted check.
99+
**Fetches the result of a previously sent check request.**
100+
101+
| Parameter | Type | Description |
102+
| ------------ | -------- | ------------------------------ |
103+
| `$requestId` | `string` | ID returned by `sendRequest()` |
84104

85105
---
86106

87107
### `runCheck(string $host, string $type, int|null $maxNodes = 0): array|false`
88108

89-
Shortcut for sending and retrieving a single check result (ping, http, etc.).
109+
**Combines `sendRequest()` and `getResults()` into one call.**
110+
111+
| Parameter | Type | Description |
112+
| ----------- | -------- | ------------------------------------------------------------------------- |
113+
| `$host` | `string` | The target domain or IP to check |
114+
| `$type` | `string` | Type of check: one of `ping`, `http`, `tcp`, `udp`, `dns`, `traceroute` |
115+
| `$maxNodes` | `int` | Max number of nodes to use (`0` = all available nodes) |
90116

91117
---
92118

93119
### `fullCheck(string $host, int|null): array|false`
94120

95-
Runs all 5 core tests (`ping`, `http`, `tcp`, `udp`, `dns`) and returns a structured result for each node.
121+
**Performs all core tests (`ping`, `http`, `tcp`, `udp`, `dns`, `traceroute`) on the given host.**
122+
123+
| Parameter | Type | Description |
124+
| ----------- | -------- | ------------------------------------------------------------ |
125+
| `$host` | `string` | The target domain or IP to check |
126+
| `$maxNodes` | `int` | Maximum number of nodes per test (`0` = all available nodes) |
96127

97128
---
98129

99130
### `setProxy(string $proxy): void`
100131

101-
Sets or updates the proxy used for all curl requests.
132+
**Sets or updates a proxy to be used for all cURL HTTP requests.**
133+
134+
| Parameter | Type | Description |
135+
| --------- | -------- | -------------------------------------------- |
136+
| `$proxy` | `string` | Proxy address, e.g., `http://127.0.0.1:8080` |
102137

103138
---
104139

105140
### `setTimeout(int $seconds): void`
106141

107-
Sets or updates the timeout for result fetching.
142+
### `setTimeout(int $seconds): void`
143+
144+
**Sets the timeout for all result fetching requests.**
145+
146+
| Parameter | Type | Description |
147+
| ---------- | ----- | --------------------------- |
148+
| `$seconds` | `int` | Timeout duration in seconds |
108149

109150
---
110151

0 commit comments

Comments
 (0)