Basic Query
Basic queries only need to pass USERNAME
and PASSWORD
without any other parameters. For a basic query, the request is sent via a random IP address, and a different proxy is used for each new request.
Code example:
In the example below, a query for ipinfo.thordata.com
is executed via a random IP.
curl -x t.pr.thordata.net:12233 -U "user-USERNAME: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
{
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:12233")
{
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();
}
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
const (
resourceUrl = "https://ipinfo.thordata.com"
proxyHost = "t.pr.thordata.net:12233"
username = "username"
password = "password"
)
func main() {
proxyUrl := &url.URL{
Scheme: "http",
User: url.UserPassword(username, 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 java.io.*;
import org.apache.http.HttpHost;
import org.apache.http.auth.*;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.*;
import org.apache.http.impl.client.*;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
public class JavaHttp {
public static final String username = "username";
public static final String password = "password";
public static final int port = 12233;
public static final String proxyHost = "t.pr.thordata.net";
public CloseableHttpClient client;
public JavaHttp() {
HttpHost proxy = new HttpHost(proxyHost, port);
CredentialsProvider cred_provider = new BasicCredentialsProvider();
cred_provider.setCredentials(new AuthScope(proxy),
new UsernamePasswordCredentials(username, 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 {
JavaHttp client = new JavaHttp();
try {
System.out.println(client.request("https://ipinfo.thordata.com"));
} finally { client.close(); }
}
}
<?php
$url = 'ipinfo.thordata.com';
$proxy = 't.pr.thordata.net';
$port = 12233;
$user = 'username';
$psw = 'password';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, "$proxy:$port");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$user:$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:12233"
proxies = {"http": f"http://{username}:{password}@{proxy_server}"}
response = requests.get("https://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:12233";
rp({
url: 'https://ipinfo.thordata.com',
proxy: `http://${username}:${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 = 12233
proxy_user = 'username'
proxy_pass = 'password'
uri = URI.parse('https://ipinfo.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
Last updated