1 | <?php |
||
19 | final class http |
||
20 | { |
||
21 | /** |
||
22 | * Returns a http\ServerRequest object with properties for most |
||
23 | * information in a server request, like url, method, body, etc. |
||
24 | * @return http\ServerRequest |
||
25 | */ |
||
26 | public static function serverRequest() |
||
34 | |||
35 | /** |
||
36 | * Returns a http\Htpasswd object with all users in the htpasswd file |
||
37 | * @param string $htpasswd a string in htpasswd format |
||
38 | * @return http\Htpasswd |
||
39 | */ |
||
40 | public static function htpasswd($htpasswd) { |
||
43 | 2 | ||
44 | /** |
||
45 | * Send a HTTP request with a specific method, GET, POST, etc. |
||
46 | * @param null $method The method to use, GET, POST, etc. |
||
47 | * @param null $url The URL to request |
||
48 | * @param null $query The query string |
||
49 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
50 | * @return string |
||
51 | */ |
||
52 | public static function request( $method = null, $url = null, $query = null, $options = [] ) |
||
58 | |||
59 | /** |
||
60 | * Create a new HTTP client with a default set of stream context options to use in all requests. |
||
61 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
62 | * @return http\ClientStream |
||
63 | */ |
||
64 | public static function client( $options = [] ) |
||
68 | |||
69 | /** |
||
70 | * Do a HTTP GET request and return the response. |
||
71 | * @param $url The URL to request |
||
72 | * @param mixed $query The query parameters |
||
73 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
74 | * @return string |
||
75 | */ |
||
76 | public static function get( $url, $query = null, $options = [] ) |
||
80 | |||
81 | /** |
||
82 | * Do a HTTP POST request and return the response. |
||
83 | * @param $url The URL to request |
||
84 | * @param mixed $query The query parameters |
||
85 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
86 | * @return string |
||
87 | */ |
||
88 | public static function post( $url, $query = null, $options = [] ) |
||
92 | |||
93 | /** |
||
94 | * Do a HTTP PUT request and return the response. |
||
95 | * @param $url The URL to request |
||
96 | * @param mixed $query The query parameters |
||
97 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
98 | */ |
||
99 | public static function put( $url, $query = null, $options = [] ) |
||
103 | |||
104 | /** |
||
105 | * Do a HTTP DELETE request and return the response. |
||
106 | * @param $url The URL to request |
||
107 | * @param mixed $query The query parameters |
||
108 | * @param array $options Any of the HTTP stream context options, e.g. extra headers. |
||
109 | * @return string |
||
110 | */ |
||
111 | public static function delete( $url, $query = null, $options = [] ) |
||
115 | } |
||
116 |