基本查詢
基本查詢僅需要輸入USERNAME和PASSWORD,無需其他任何參數。對於基本查詢,是通過隨機IP地址發送請求,每次新的請求都會使用不同的代理。
代碼示例
在下方示例中,通過隨機IP執行對ipinfo.thordata.com的查詢
curl -x t.pr.thordata.net:5555 -U "td-customer-USERNAME:PASSWORD" ipinfo.thordata.comusing System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class csharp_http
{
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("http://t.pr.thordata.net:5555")
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: "username",
password: "password")
};
var httpClientHandler = new HttpClientHandler()
{
Proxy = proxy,
};
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?