Method ExtInternet.Get(+ 1 overload)
Overload
Sends a GET request to the specified URL, and gets the response.
public static HttpResponseMessage Get(this HttpClient t, string url, bool dontWait = false, IEnumerable<string> headers = null, string auth = null, Action<HttpRequestMessage> also = null)
Parameters
t (HttpClient) |
url (string)
URL. To create URL with urlencoded parameters you can use internet.urlAppend. |
dontWait (bool) |
headers (IEnumerable<string>)
|
auth (string)
String like |
also (Action<HttpRequestMessage>)
Can set more properties for the request. |
Returns
HttpResponseMessage
An HttpResponseMessage object that can be used to get response content (web page HTML, JSON, file, etc), headers etc. To get content use ExtInternet.Text etc. |
Exceptions
Exception
Exceptions of System.Net.Http.HttpClient.Send. If headers used, exceptions of ExtInternet.AddMany. |
UriFormatException
Invalid URL format. |
Examples
string s = internet.http.Get("https://httpbin.org/anything").Text();
Overload(top)
Sends a GET request to the specified URL, and gets the response. Saves the response content (file, web page, etc) in a file.
public static HttpResponseMessage Get(this HttpClient t, string url, string resultFile, IEnumerable<string> headers = null, string auth = null, Action<HttpRequestMessage> also = null)
Parameters
t (HttpClient) |
url (string)
URL. To create URL with urlencoded parameters you can use internet.urlAppend. |
resultFile (string)
File path. The function uses pathname.normalize. Creates parent directory if need. |
headers (IEnumerable<string>)
|
auth (string)
String like |
also (Action<HttpRequestMessage>)
Can set more properties for the request. |
Returns
HttpResponseMessage
An HttpResponseMessage object that contains response headers etc. Rarely used. |
Exceptions
Exception
Exceptions of System.Net.Http.HttpClient.Send and ExtInternet.Save. If headers used, exceptions of ExtInternet.AddMany. |