發送請求
使用您的靜態ISP代理向 https://ipinfo.thordata.com 發起請求。請將 USERNAME 和 PASSWORD 替換為您的代理用戶憑據。
curl -x IP:6666 -U "USERNAME:PASSWORD" "https://ipinfo.thordata.com"請注意,必須嚴格遵循上述範例中的用戶名字串構建格式才能成功發起請求。務必保持語法結構完全一致,並注意用戶名和密碼區分大小寫。
代码示例
curl -x ip:6666 -U "USERNAME:PASSWORD" "https://ipinfo.thordata.com"using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
class csharp_https
{
static void Main(string[] args)
{
Task t = new Task(DownloadPageAsync);
t.Start();
Console.ReadLine();
}
static async void DownloadPageAsync()
{
string page = "https://ipinfo.thordata.com";
var proxy = new WebProxy("https://ip:6666")
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: "USERNAME",
password: "PASSWORD")
};
var httpClientHandler = new HttpClientHandler()
{
Proxy = proxy,
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);
var response = await client.GetAsync(page);
using (HttpContent content = response.Content)
{
string result = await content.ReadAsStringAsync();
Console.WriteLine(result);
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}Last updated
Was this helpful?