基本查詢
基本查詢僅需要傳遞USERNAME
和PASSWORD
,無需其他任何參數。對於基本查詢,是通過隨機IP地址發送請求,每次新的請求都會使用不同的代理。
代碼示例
在下方示例中,通過隨機IP執行對ipinfo.thordata.com
的查詢
curl -x t.pr.thordata.net:12233 -U "user-USERNAME:PASSWORD" ipinfo.thordata.com
using System;
using System.Net;
class Example
{
static void Main()
{
var client = new WebClient();
client.Proxy = new WebProxy("t.pr.thordata.net:12233");
client.Proxy.Credentials = new NetworkCredential("user-USERNAME", "PASSWORD");
Console.WriteLine(client.DownloadString("https://ipinfo.thordata.com"));
}
c
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 't.pr.thordata.net:12233';
$query = curl_init('https://ipinfo.thordata.com');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "user-$username:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
echo $output;
?>
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
entry = ('http://user-%s:%s@t.pr.thordata.net:12233' %
(username, password))
query = urllib.request.ProxyHandler({
'http': entry,
'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ipinfo.thordata.com').read())
package example;
import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;
public class Example {
public static void main(String[] args) throws Exception {
HttpHost entry = new HttpHost("t.pr.thordata.net", 12233);
String query = Executor.newInstance()
.auth(entry, "user-USERNAME", "PASS")
.execute(Request.Get("http://ipinfo.thordata.com").viaProxy(entry))
.returnContent().asString();
System.out.println(query);
}
}
require 'uri'
require 'net/http'
uri = URI.parse('https://ipinfo.thordata.com/')
proxy = Net::HTTP::Proxy('t.pr.thordata.net:12233', 4950, 'user-USERNAME', 'PASSWORD')
req = Net::HTTP::Get.new(uri.path)
result = proxy.start(uri.host,uri.port) do |http|
http.request(req)
end
puts result.body
Last updated