忘记密码

成功验证手机号即可找回密码

请输入密码
请确认密码
用户登录 每天免费领20IP
请输入密码
忘记密码
注册免费试用
注册即送10000IP
请输入密码
复制成功
请粘贴在新的浏览器或标签页内打开
确定
账户余额不足10元

为了不影响您的正常使用,请及时充值!

我知道了

恭喜您注册成功!
已成功领取账户余额

25 1
立即领取

手机号绑定成功!
已成功领取账户余额

25 1
立即领取

API接口使用问题

*代理模式: 为其他对象提供一种代理以控制对这个对象的访问*//*普通代理:  调用者只能访问代理角色,而不能访问真实角色。 调用者只知道代理而不用知道真实角色,屏蔽了真实角色的变更对高层模块的影响。*#include#include#include/*抽象游戏者  代理*/typedef struct _IGamePlayer IGamePlayer;struct _IGamePlayer{    void (*login)(char *pName, char *pPassword, void *);    void (*killBoss)(void *);    void (*upgrade)(void *);    void (*DeleteIGamePlayer)(void *);};/*游戏者   具体*/typedef struct _GamePlayer GamePlayer;struct _GamePlayer{    IGamePlayer gmplayer;   /*继承抽象游戏者*/    char acName[10];        /*游戏者姓名*/    void (*DeleteGamePlayer)(GamePlayer *pGamePlayer);};void login(char *pName, char *pPassword, void *pGamePlayer){    printf("user :%s is login in !\n", pName);}void killBoss(void *pGamePlayer){    printf("%s is killing the boss! \n", ((GamePlayer *)pGamePlayer)->acName);}void upgrade(void *pGamePlayer){    printf("%s is upgrading !\n", ((GamePlayer *)pGamePlayer)->acName);}void DeleteGamePlayer(GamePlayer *pGamePlayer){    if(pGamePlayer)    {        free(pGamePlayer);        pGamePlayer = NULL;    }}GamePlayer *CreateGamePlayer(IGamePlayer *pIGamePlayer, char *pName){    GamePlayer *pGamePlayer = NULL;    if(!pIGamePlayer)    {        return NULL;    }    else    {        pGamePlayer = (GamePlayer *)malloc(sizeof(GamePlayer));        if(!pGamePlayer)        {            return NULL;        }        memset(pGamePlayer, 0, sizeof(GamePlayer));        strcpy(pGamePlayer->acName, pName);        pGamePlayer->DeleteGamePlayer = DeleteGamePlayer;        pGamePlayer->gmplayer.login = login;        pGamePlayer->gmplayer.killBoss = killBoss;        pGamePlayer->gmplayer.upgrade = upgrade;        pGamePlayer->gmplayer.DeleteIGamePlayer = pGamePlayer->DeleteGamePlayer;        return pGamePlayer;    }}/*普通代理的代理者*/typedef struct _GamePlayerProxy GamePlayerProxy;struct _GamePlayerProxy{    IGamePlayer gmplayer;   /*继承抽象游戏者*/    GamePlayer *pGamePlayer; /*被代理者*/    void (*DeleteGamePlayerProxy)(GamePlayerProxy *pGamePlayerProxy);};void ProxykillBoss(void * pGamePlayerProxy){((GamePlayerProxy *)pGamePlayerProxy)->pGamePlayer->gmplayer.killBoss(((GamePlayerProxy *)pGamePlayerProxy)->pGamePlayer);    /*代理执行被代理者的方法*/}void Proxylogin(char *pName, char *pPassword, void *pGamePlayerProxy){    ((GamePlayerProxy *)pGamePlayerProxy)->pGamePlayer->gmplayer.login(pName, pPassword, pGamePlayerProxy);}void Proxyupgrade(void *pGamePlayerProxy){    ((GamePlayerProxy *)pGamePlayerProxy)->pGamePlayer->gmplayer.upgrade(((GamePlayerProxy *)pGamePlayerProxy)->pGamePlayer);}void DeleteGamePlayerProxy(GamePlayerProxy *pGamePlayerProxy){    if(pGamePlayerProxy->pGamePlayer)    {        pGamePlayerProxy->pGamePlayer->DeleteGamePlayer(pGamePlayerProxy->pGamePlayer);    }    if(pGamePlayerProxy)    {        free(pGamePlayerProxy);        pGamePlayerProxy = NULL;    }    return;}GamePlayerProxy *CreateProxy(char *pName){    GamePlayerProxy *pGamePlayerProxy = NULL;    pGamePlayerProxy = (GamePlayerProxy *)malloc(sizeof(GamePlayerProxy));    if(!pGamePlayerProxy)    {        return NULL;    }    memset(pGamePlayerProxy, 0, sizeof(GamePlayerProxy));    pGamePlayerProxy->pGamePlayer = CreateGamePlayer(                            (IGamePlayer *)pGamePlayerProxy, pName);  /*创建被代理者*/    pGamePlayerProxy->DeleteGamePlayerProxy = DeleteGamePlayerProxy;    pGamePlayerProxy->gmplayer.login = Proxylogin;    pGamePlayerProxy->gmplayer.killBoss = ProxykillBoss;    pGamePlayerProxy->gmplayer.upgrade = Proxyupgrade;    pGamePlayerProxy->gmplayer.DeleteIGamePlayer = pGamePlayerProxy->DeleteGamePlayerProxy;    return pGamePlayerProxy;}/*场景*/void main(){    /*定义一个代理者*/    IGamePlayer *pPlayProxy = (IGamePlayer *)CreateProxy("zhangsan"); //转换为抽象类, 即场景只依赖于抽象类    /*开始打游戏,记下时间戳*/    printf("game start time is : 2014-1-21 9:00\n");    /*代理登录*/    pPlayProxy->login("zhangsan", "password", pPlayProxy);    /*代理打怪*/    pPlayProxy->killBoss(pPlayProxy);    /*代理升级*/    pPlayProxy->upgrade(pPlayProxy); /*游戏结束*/    printf("game end time is :2014-1-21 10:00");    /*释放资源*/    pPlayProxy->DeleteIGamePlayer(pPlayProxy);}
go语言启用代理ip:package mainimport ("fmt""io/ioutil""net/http""net/url")//sock5代理func socksproxy() {urli := url.URL{}urlproxy, _ := urli.Parse("http://测试ip:端口")client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(urlproxy),},}rqt, err := http.NewRequest("GET", "http://myip.top", nil)if err != nil {println("接口获取IP失败!")return}rqt.Header.Add("User-Agent", "Lingjiang")//处理返回结果response, _ := client.Do(rqt)defer response.Body.Close()body, err := ioutil.ReadAll(response.Body)if err != nil {return}fmt.Println("socks5:", string(body))return}//http代理func httpproxy() {urli := url.URL{}urlproxy, _ := urli.Parse("http://测试ip:端口")client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(urlproxy),},}rqt, err := http.NewRequest("GET", "http://myip.top", nil)if err != nil {println("接口获取IP失败!")return}rqt.Header.Add("User-Agent", "Lingjiang")//处理返回结果response, _ := client.Do(rqt)defer response.Body.Close()body, err := ioutil.ReadAll(response.Body)if err != nil {return}fmt.Println("http:", string(body))return}//本机IPfunc httplocal() {client := &http.Client{}rqt, err := http.NewRequest("GET", "http://myip.top", nil)if err != nil {println("接口获取IP失败!")return}rqt.Header.Add("User-Agent", "Lingjiang")//处理返回结果response, _ := client.Do(rqt)defer response.Body.Close()body, err := ioutil.ReadAll(response.Body)if err != nil {return}fmt.Println("本机:", string(body))return}func main() {httplocal()httpproxy()socksproxy()}
phantomjs 可通过以下设置代理ip#coding=utf-8import osimport reimport timeimport requestsfrom scrapy.selector import HtmlXPathSelectorfrom scrapy.http import HtmlResponsefrom selenium import webdriverfrom selenium.webdriver.common.proxy import ProxyTypeimport sysreload(sys)sys.setdefaultencoding("utf-8")import warningswarnings.filterwarnings("ignore")if __name__ == '__main__':PATH_PHANTOMJS=r'D:\phantomjs\bin\phantomjs.exe'browser=webdriver.PhantomJS(PATH_PHANTOMJS)#真实ipbrowser.get('http://icanhazip.com/') #获取ip网址response = HtmlResponse(url='',body=str(browser.page_source))hxs = HtmlXPathSelector(response)print 'your ip is:',''.join(hxs.select('//text()').extract()).strip()#代理ipproxy=webdriver.Proxy()proxy.proxy_type=ProxyType.MANUALproxy.http_proxy='220.248.229.45:3128'#将代理设置添加到webdriver.DesiredCapabilities.PHANTOMJS中proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)browser.start_session(webdriver.DesiredCapabilities.PHANTOMJS)browser.get('http://icanhazip.com/') #获取ip网址response = HtmlResponse(url='',body=str(browser.page_source))hxs = HtmlXPathSelector(response)print 'your proxy ip is:',''.join(hxs.select('//text()').extract()).strip()重点接入代码:Phantomjs http/socks5:phantomjs --proxy=ip:port --proxy-type=[http|socks5|none] demo.js
Selenium启用代理ip:Python selenium http/socks5:#coding=utf-8from selenium import webdriver# 代理服务器proxyHost = "ip"proxyPort = "port"proxyType='http' #socks5# 代理隧道验证信息service_args = [    "--proxy-type=%s" % proxyType,    "--proxy=%(host)s:%(port)s" % {        "host" : proxyHost,        "port" : proxyPort,    }    ]# 要访问的目标页面targetUrl = "http://baidu.com"driver = webdriver.PhantomJS(service_args=service_args)driver.get(targetUrl)print driver.titleprint driver.page_source.encode("utf-8")driver.quit()
Php http/sock5:// 要访问的目标页面        $targetUrl = "http://baidu.com";        // 代理服务器        $proxyServer = "http":"http://ip:port";        // 隧道身份信息        $ch = curl_init();        curl_setopt($ch, CURLOPT_URL, $targetUrl);        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);        // 设置代理服务器//        curl_setopt($ch, CURLOPT_PROXYTYPE, 0); //http        curl_setopt($ch, CURLOPT_PROXYTYPE, 5); //sock5        curl_setopt($ch, CURLOPT_PROXY, $proxyServer);        // 设置隧道验证信息        curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;)");        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);        curl_setopt($ch, CURLOPT_TIMEOUT, 5);        curl_setopt($ch, CURLOPT_HEADER, true);        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);        $result = curl_exec($ch);        curl_close($ch);        var_dump($result);
代码参考:#coding=utf-8import requests#请求地址targetUrl = "https://www.baidu.com"#代理服务器proxyHost = "ip"proxyPort = "port"proxyMeta = "http://%(host)s:%(port)s" % {    "host" : proxyHost,    "port" : proxyPort,}#pip install -U requests[socks]  socks5 # proxyMeta = "socks5://%(host)s:%(port)s" % {#     "host" : proxyHost,#     "port" : proxyPort,# }proxies = {    "http"  : proxyMeta,    "https"  : proxyMeta}resp = requests.get(targetUrl, proxies=proxies)print resp.status_codeprint resp.text
API提取之分隔符介绍

发布时间 2021-06-16

我们在获取API页面会看到分隔符的选项,分隔符的选择,代表我们提取出来的IP之间是以什么符号分隔开的。1、选择回车或换行分隔符,提取出来的IP都是一行一个IP。例如:111.22.333.44:1234111.22.344.55:1579111.22.355.66:12462、选择Tab分隔符,每个IP之间是以空格来分隔开的。例如:111.22.333.44:1234 111.22.344.55:1579 111.22.355.66:12463、选择其他符号,就可以在横线上,输入自己想要的符号来做为IP的分隔符;如果勾选了其他符号,横线上不输入任何符号,就会默认0作为分隔符。111.22.333.44:12340111.22.344.55:15790111.22.355.66:12460
IP的相应速度和稳定时长介绍

发布时间 2021-06-10

1、代理IP的响应速度:是指我们用这个代理去访问百度首页所需要的时间。芝麻HTTP给出的响应速度是中国测速服务器的测试数据,仅供参考。响应速度根据使用代理的机器所在的地理位置不同而有差异。响应时间越短,速度也就越快。2、代理IP的稳定时长:是指代理IP的有效时间有多长。比如芝麻HTTP的5-25分钟IP,稳定时长就是5-25分钟,也就是说,5-25分钟后,代理IP就会失效,我们就不能再使用了,需要重新提取新的IP。芝麻HTTP代理提取IP不扣费,使用才扣费。芝麻HTTP代理的所有IP都是自建机房产出的,安全、稳定、可用率高。大家可以根据自己的需要来选择稳定连接时长。注:(1)如需要其他定制服务的大客户请联系(日消耗大于5万IP)大客户经理 “鲁先生”  微信:17696587288。(2)官方网站:芝麻软件:http://www.zhimaruanjian.com芝麻http/https/socks5:http://h.zhimaruanjian.com/每个产品都有对应的客服,请跳转后进行咨询。
1万IP

18505167110

扫微信客服
咨询产品

售后

18068702572

扫微信客服
咨询产品

客户
定制

客户定制

18115265820

18115265820

扫微信客服
咨询产品

大客户套餐服务

18115265820

18115265820

扫微信客服
咨询产品

置顶

关注芝麻HTTP公众号
获取产品最新咨询

扫微信客服
获取产品最新咨询