isp
URL (API endpoint)
Request URL
https://tmproxy.com/api/proxy/ispRequest body
Example Value
{}Schema
responseIsp{
code integer
message string
data {
locations [
ISPModel{
id_isp integer
name string
name isp
}
]
}
}Server response OK
Response body - code 200
{
"code": 0,
"message": "string",
"data": {
"list_isp": [
{
"id_isp": 0,
"name": "Random"
},
{
"id_isp": 1,
"name": "Viettel"
},
{
"id_isp": 2,
"name": "VNPT"
}
]
}
}Example Code
JavaScript (fetch API)
fetch('https://tmproxy.com/api/proxy/isp', {
method: 'POST',
headers: { 'accept': 'application/json' }
})
.then(response => response.json())
.then(data => {
if (data.code === 0 && data.data?.list_isp) {
data.data.list_isp.forEach((isp, index) => {
console.log(`ISP ${index + 1}:`, isp);
});
} else {
console.error("Error:", data.msg || "Unknown error");
}
})
.catch(error => console.error("Error:", error));Python (requests library)
import requests
url = "https://tmproxy.com/api/proxy/isp"
headers = {
"accept": "application/json",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json={})
print(response.json())Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://tmproxy.com/api/proxy/isp"
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(`{}`)))
if err != nil {
panic(err)
}
req.Header.Set("accept", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
fmt.Println("Error:", resp.Status)
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("Response Body:", string(body))
return
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
var data map[string]interface{}
err = json.Unmarshal(body, &data)
if err != nil {
panic(err)
}
if data["code"].(float64) == 0 && data["data"] != nil {
isps := data["data"].(map[string]interface{})["list_isp"].([]interface{})
for i, isp := range isps {
fmt.Printf("ISP %d: %+v\n", i+1, isp)
}
} else {
fmt.Println("Error:", data["msg"])
}
}Curl
curl -X POST "https://tmproxy.com/api/proxy/isp" -H "accept: application/json" -H "Content-Type: application/json" -d "{}"PHP (cURL)
<?php
$url = "https://tmproxy.com/api/proxy/isp";
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => "{}",
CURLOPT_HTTPHEADER => ['accept: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data && $data['code'] === 0 && isset($data['data']['list_isp'])) {
foreach ($data['data']['list_isp'] as $index => $isp) {
echo "ISP " . ($index + 1) . ": ";
print_r($isp);
}
} else {
echo "Error: " . ($data['msg'] ?? 'Unknown error') . "\n";
}
?>
Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import org.json.JSONArray;
public class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://tmproxy.com/api/proxy/isp");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) {
byte[] input = "{}".getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
JSONObject data = new JSONObject(response.toString()).getJSONObject("data");
JSONArray isps = data.getJSONArray("list_isp");
for (int i = 0; i < isps.length(); i++) {
System.out.println("ISP " + (i + 1) + ": " + isps.getJSONObject(i).toString(2));
}
}
} else {
System.out.println("Error: " + responseCode);
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getErrorStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println("Error Response Body: " + response.toString());
}
}
connection.disconnect();
}
}C#
// C# (HttpClient)
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
public class Example
{
public static async Task Main(string[] args)
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
var content = new StringContent("{}", Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://tmproxy.com/api/proxy/isp", content);
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
}