发送请求
基本查询
基本查询仅需要输入USERNAME和PASSWORD,无需其他任何参数。对于基本查询,是通过随机IP地址发送请求,每次新的请求都会使用不同的代理。
代码示例:
在下方示例中,通过随机IP执行对ipinfo.thordata.com的查询
curl -x "https://td-customer-USERNAME:[email protected]:5555" "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://t.pr.thordata.net:5555")
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: "td-customer-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();
}
}
}特定请求
Thordata支持在用户名中添加定位与会话参数,以指定代理的大洲、国家/地区来源或控制会话行为。
代码示例:
使用来自澳大利亚墨尔本的代理,并设置 10 分钟的粘性会话:
curl -x "http://td-customer-USERNAME-country-au-state-victoria-city-melbourne-sessid-au123-sesstime-10:[email protected]:5555" "https://ipinfo.thordata.com"查询参数
username
代理帐户用户名
td-customer-username
continent
大洲,随机地区无此参数
continent-asia
country
国家/地区,随机地区无此参数
country-au( 2 个字母的国家代码)
state
州,随机地区无此参数
state-victoria
city
您要指定的城市。可以不带“state”参数使用
city-melbourne
session
粘性 IP 和IP 所需。在固定 IP 或切换时查找特定 IP 时使用它
sessid-au123456
sessTime
与会话一起使用来设置 IP 持续时间,最长时间为 90分钟
sessTime-5
password
代理账户密码
password
asn
指定国家的ISP运营商,随机无此参数
asn-AS1221
Last updated
Was this helpful?