大洲
要從七大洲中獲取代理,請在授權字符串中添加 continent 參數和兩個字母的代碼。可選擇的大洲列表及相應的字母代碼如下:
continent-AF 代表非洲
continent-AN 代表南極洲
continent-AS 代表亞洲
continent-EU 代表歐洲
continent-NA 代表北美洲
continent-OC 代表大洋洲
continent-SA 代表南美洲
代碼示例:
在此範例中,從亞洲的隨機 IP 地址查詢 ipinfo.thordata.com
curl -x "https://td-customer-USERNAME-continent-as:[email protected]:5555" "https://ipinfo.thordata.com"using 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.na.thordata.net:5555")
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: "td-customer-USERNAME-continent-as",
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?