Thordata Docs
繁體中文
繁體中文
  • 概述
  • 代理
    • 集成教程
      • 住宅代理集成
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Hubstudio
        • Playwright
        • Puppeteer
        • Selenium
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
        • MuLogin
      • ISP代理集成
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Hubstudio
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
      • 數據中心代理集成
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Hubstudio
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
      • 無限代理集成
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Hubstudio
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
    • 住宅代理
      • 入門指南
      • 端點產生器
        • 賬密認證
        • IP白名單
          • 國家條目提取
            • 國家/地區入口節點
          • API鏈接
      • 賬戶
      • 基本查詢
      • 位置設置
        • 國家/地區
        • 城市
        • 州
      • 會話控制
      • 協議
      • 國家/地區列表
      • CDKEY生成與兌換
    • ISP代理
      • 入門指南
    • 數據中心代理
      • 入門指南
    • 無限代理伺服器
      • 端點產生器
        • 賬密認證
        • IP白名單
          • 國家條目提取
          • API鏈接
      • 賬戶
      • 國家/地區列表
  • 爬取
    • SERP API
      • 入門指南
      • 配置
      • API實驗場
      • SSL 證書
      • 發送您的第一次請求
      • 解析後的 JSON 結果
      • SERP API Google 查詢參數
      • SERP API Bing 查詢參數
  • WEB Scraper API
    • 入門指南
    • API 請求建構器
  • 免費工具
    • 谷歌擴展程序
      • 使用教程
  • 有用的链接
    • 儀表板中心
  • 常見問題
    • 產品問題
      • 我該如何選擇合適的代理套餐?
      • 如何定位特定的國家/地區?
      • 如何定位特定的城市?
      • 什麼是無限代理?
      • IP檢測結果與購買提取的地區不符?
    • 付款問題
      • 支持哪些支付方式?
      • 購買錯套餐怎麼辦?
      • 是否提供付費服務退款?
      • 付款後,收到代理餘額或激活我的帳戶需要多長時間?
  • 支持
    • 聯繫我們
Powered by GitBook
On this page

Was this helpful?

  1. 代理
  2. 住宅代理
  3. 位置設置

城市

我們支持將IP精準至城市級定位,只需要使用city參數。例如:country-US-city-houston表示來自美國休斯頓的IP。

注意:city參數必須與country參數一起使用,單獨使用city參數無法獲取指定國家城市的IP!city參數和state、ASN參數無法同時使用!

我們願意為全球範圍內的任何城市提供支持,但我們不保證在所有城市都設有代理。在大多數熱門城市中,我們的覆蓋率良好,並且提供了諸多代理選擇。

以下是一些城市參數的有效示例:

國家-城市
國家-城市參數

德國-慕尼黑

country-DE-city-munich

印度-新德里

country-IN-city-delhi

泰國-曼谷

country-TH-city-bangkok

韓國-首爾

country-KR-city-seoul

日本-東京

country-JP-city-tokyo

代碼示例:

使用來自美國休斯顿的隨機IP地址對ipinfo.thordata.com執行查詢

curl -x t.pr.thordata.net:9999 -U "td-customer-USERNAME-country-US-city-houston:PASSWORD" 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_region
{
    static void Main(string[] args)
    {
        Task t = new Task(DownloadPageAsync);
        t.Start();
        Console.ReadLine();
    }

    static async void DownloadPageAsync()
    {
        string page = "https://ipinfo.thordata.com";

        String username = "username";
        String password = "password";
        String country = "us";
        String city = "houston";
        String proxyUserName = $"td-customer-{username}-country-{country}-city-{city}";


        var proxy = new WebProxy("http://t.pr.thordata.net:9999")
        {
            UseDefaultCredentials = false,

            Credentials = new NetworkCredential(
                userName: proxyUserName,
                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();

        }
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
)

const (
	resourceUrl = "https://ipinfo.thordata.com"
	proxyHost   = "t.pr.thordata.net:9999"
	username    = "username"
	password    = "password"
	country     = "us"
	city        = "houston"
)

func main() {
	proxyUserName := fmt.Sprintf("td-customer-%s-country-%s-city-%s", username, country, city)
	proxyUrl := &url.URL{
		Scheme: "http",
		User:   url.UserPassword(proxyUserName, password),
		Host:   proxyHost,
	}

	client := http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyURL(proxyUrl),
		},
	}

	resp, err := client.Get(resourceUrl)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}

	bodyString := string(body)
	fmt.Println(bodyString)
}
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

public class JavaHttpRegionCity {
    public static final String username = "username";
    public static final String password = "password";
    public static final int port = 9999;

    public static final String region = "us";
    public static final String city = "houston";
    public static final String proxyHost = "t.pr.thordata.net";

    public static final String proxyname = String.format("td-customer-%s-country-%s-city-%s", username, region,city);
    public CloseableHttpClient client;


    public JavaHttpRegionCity() {
        HttpHost proxy = new HttpHost(proxyHost, port);
        CredentialsProvider cred_provider = new BasicCredentialsProvider();
        cred_provider.setCredentials(new AuthScope(proxy),
                new UsernamePasswordCredentials(proxyname, password));
        client = HttpClients.custom()
                .setConnectionManager(new BasicHttpClientConnectionManager())
                .setProxy(proxy)
                .setDefaultCredentialsProvider(cred_provider)
                .build();
    }

    public String request(String url) throws IOException {
        HttpGet request = new HttpGet(url);
        CloseableHttpResponse response = client.execute(request);
        try {
            return EntityUtils.toString(response.getEntity());
        } finally { response.close(); }
    }

    public void close() throws IOException { client.close(); }

    public static void main(String[] args) throws IOException {
        JavaHttpRegionCity client = new JavaHttpRegionCity();
        try {
            System.out.println(client.request("https://ipinfo.thordata.com"));
        } finally { client.close(); }
    }
}
<?php
  $url = 'ipinfo.thordata.com';
  $proxy = 't.pr.thordata.net';
  $port = 9999;
  $user = 'username';
  $psw = 'password';
  $country = 'us';
  $city = 'houston';
  $proxyuser = sprintf("td-customer-%s-country-%s-city-%s",$user,$country,$city);


  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
  curl_setopt($ch, CURLOPT_PROXY, "$proxy:$port");
  curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$proxyuser:$psw");
  $result = curl_exec($ch);
  curl_close($ch);
  
  if ($result)
  {
      echo $result . PHP_EOL;
  }
?>
import requests

username = "username"
password = "password"
proxy_server = "t.pr.thordata.net:9999"
country = "us"
city = "houston"

proxies = {
    "http": f"http://td-customer-{username}-country-{country}-city-{city}:{password}@{proxy_server}"
}
response = requests.get("http://ipinfo.thordata.com", proxies=proxies)
print(response.text)
const rp = require('request-promise');

const username = "username";
const password = "password";
const proxyServer = "t.pr.thordata.net:9999";
const country = "us";
const city = "houston";

rp({
    url: 'http://ipinfo.thordata.com',  
    proxy: `http://td-customer-${username}-country-${country}-city-${city}:${password}@${proxyServer}`,  
})
.then(function(data) {
    console.log(data);  
})
.catch(function(err) {
    console.error(err); 
});
require "uri" 
require 'net/http' 

proxy_host = 't.pr.thordata.net' 
proxy_port = 9999 
proxy_username = 'username'
proxy_pass = 'password'
proxy_country = 'us'
proxy_city = 'houston'
proxy_user = "td-customer-#{proxy_username}-country-#{proxy_country}-city-#{proxy_city}"

uri = URI.parse('https://ipin.thordata.com') 
proxy = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass) 

req = Net::HTTP::Get.new(uri)

result = proxy.start(uri.host, uri.port, use_ssl: true) do |http| 
  http.request(req) 
end 

puts result.body
Previous國家/地區Next州

Last updated 3 months ago

Was this helpful?