API提取
生成代码工具
快速生成API
API文档
参数 | 说明 |
---|---|
API地址 | 购买对应产品后生成 |
order | 订单号,是判断是否为您购买产品的重要标志,必填 |
num | 单次调用返回的IP数量,必填 |
sep | 换行符,支持:\n \r\n | 三种格式 |
type | 返回数据格式 json:返回json、text:返回文本格式 |
end_time | 代理IP生效与失效时间,1=返回 0=不返回(此选功能支持json格式下使用) |
apikey | 账户的token,自动生成,可在控制台修改 |
返回结果示例
TXT示例
113.231.36.186:54235
58.52.85.164:58748
111.224.221.22:49196
42.52.172.48:35279
218.6.105.104:18871
180.122.106.51:25642
111.224.220.203:35515
121.230.9.148:24157
58.52.82.88:21065
42.177.59.119:16291
JSON示例
[
{
"proxy": "111.224.219.35:44268",
"start": "03:27:37",
"end": "03:30:01"
},
{
"proxy": "121.230.9.148:17295",
"start": "03:27:33",
"end": "03:30:01"
},
{
"proxy": "121.230.9.78:12810",
"start": "03:27:19",
"end": "03:30:01"
},
{
"proxy": "110.86.176.68:58942",
"start": "03:27:43",
"end": "03:30:01"
},
{
"proxy": "180.103.19.93:47218",
"start": "03:27:42",
"end": "03:30:01"
}
]
#encoding=UTF-8
import http.client
import base64
# 请求头认证方式暂时不支持https协议
# 请通过添加ip白名单方式添加全局支持
# (登录状态下调用,公网ip请通过网络查询)
def base_code(username, password):
str = '%s:%s' % (username, password)
encodestr = base64.b64encode(str.encode('utf-8'))
return '%s' % encodestr.decode()
if __name__ == '__main__':
username = "xxxxxxxx" # 您的用户名
password = "xxxxx" # 您的密码
proxy_ip = "xx.xx.xx.xx" # ip
proxy_port = "xxx" # IP端口号
headers = {
'Proxy-Authorization': 'Basic %s' % (base_code(username, password))
}
url = 'https://api.ip.cc'
try :
con = http.client.HTTPConnection(proxy_ip, port=proxy_port, timeout=10)
con.request("GET", url, headers=headers)
resu = con.getresponse()
text = resu.read().decode("utf-8", errors="ignore")
print(text)
except Exception as e:
print(e)
// 设置IP,格式 ip:port
$proxyServer = "ip:port";
$ch = curl_init();
// 设置请求地址
curl_setopt($ch, CURLOPT_URL, "https://api.ip.cc");
// 设置IP,格式 http://ip:port
curl_setopt($ch, CURLOPT_PROXY, "http://$proxyServer");
// https请求 不验证证书和hosts
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$output = curl_exec($ch);
if ($output === FALSE) {
echo "CURL Error:" . curl_error($ch);
} else {
echo $output;
}
curl_close($ch);
package main
import (
"fmt"
"golang.org/x/net/proxy"
"io/ioutil"
"net/http"
"net/url"
"os"
)
func httpProxy(targetUrlString, httpProxyServer string) {
targetUrl := url.URL{}
//配置IP服务器
proxyServer, _ := targetUrl.Parse("http://" + httpProxyServer)
//设置一个http客户端
client := &http.Client{
Transport: &http.Transport{
//设置IP服务器
Proxy: http.ProxyURL(proxyServer),
},
}
//访问地址
rqt, err := http.NewRequest("GET", targetUrlString, nil)
if err != nil {
println("请求网站失败")
return
}
//处理返回结果
response, _ := client.Do(rqt)
defer response.Body.Close()
//读取内容
body, err := ioutil.ReadAll(response.Body)
if err != nil {
return
}
//输入响应结果
fmt.Println("socket5 请求结果:", string(body))
}
func socket5Proxy(targetUrlString, httpProxyServer string) {
dialer, err := proxy.SOCKS5("tcp", httpProxyServer, nil, proxy.Direct)
if err != nil {
fmt.Println(os.Stderr, "can't connect to the proxy:", err)
os.Exit(1)
}
// setup a http client
httpTransport := &http.Transport{}
client := &http.Client{Transport: httpTransport}
// set our socks5 as the dialer
httpTransport.Dial = dialer.Dial
//访问地址
rqt, err := http.NewRequest("GET", targetUrlString, nil)
if err != nil {
println("请求网站失败")
return
}
//处理返回结果
response, _ := client.Do(rqt)
defer response.Body.Close()
//读取内容
body, err := ioutil.ReadAll(response.Body)
if err != nil {
return
}
//输入响应结果
fmt.Println("http 请求结果:", string(body))
}
func main() {
httpProxy("https://api.ip.cc", "服务器ip:服务器http端口")
socket5Proxy("https://api.ip.cc", "服务器ip:服务器socket5端口")
}
using System;
using System.IO;
using System.IO.Compression;
using System.Net;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// 要访问的目标网页
string page_url = "https://api.ip.cc";
// 构造请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(page_url);
request.Method = "GET";
// 代理服务器
string proxy_ip = "代理服务器ip";
int proxy_port = 代理服务器端口;
// 设置代理 (私密/独享代理&未添加白名单)
WebProxy proxy = new WebProxy();
proxy.Address = new Uri(String.Format("http://{0}:{1}", proxy_ip, proxy_port));
request.Proxy = proxy;
// 请求目标网页
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine((int)response.StatusCode); // 获取状态码
// 解压缩读取返回内容
Stream responseStream = response.GetResponseStream();
byte[] bArr = new byte[1024];
try
{
int size = responseStream.Read(bArr, 0, (int)bArr.Length);
Console.Write(System.Text.Encoding.Default.GetString(bArr));
}
catch (Exception ex)
{
Console.WriteLine("下载出错");
return;
}
responseStream.Close();
return;
}
}
}
import okhttp3.*;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
public class DemoProxy {
public static void main(String[] args) throws IOException {
String targetUrl = "https://api.ip.cc";
String ip = "代理服务器IP"; // 代理服务器IP
int port = 代理服务器端口;
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ip, port));
OkHttpClient client = new OkHttpClient.Builder()
.proxy(proxy)
.build();
Request request = new Request.Builder()
.url(targetUrl)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
import kotlin.Throws
import java.io.IOException
import kotlin.jvm.JvmStatic
import java.net.InetSocketAddress
import okhttp3.OkHttpClient
import okhttp3.Request
import java.net.Proxy
object DemoProxy {
@Throws(IOException::class)
@JvmStatic
fun main(args: Array) {
val targetUrl = "https://api.ip.cc"
val ip = "代理服务器IP" // 代理服务器IP
val port = 代理服务器端口
val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress(ip, port))
val client = OkHttpClient.Builder()
.proxy(proxy)
.build()
val request = Request.Builder()
.url(targetUrl)
.build()
val response = client.newCall(request).execute()
println(response.body().string())
}
}
更多语言
在线客服
客服QQ:3338531519
热线:400-889-8974