您的位置 首页 php

PHP&Python获取当前网络外网ip地址

网络地址来源:

 获取 公网IP 地址                  






{IP:255.255.255.255}

  

python

 import requests
from bs4 import BeautifulSoup
def getIP():
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.16 Safari/537.36",
    }

    url = '#39;
    response = requests.get(url=url,
                            headers=headers).content. decode ()
    soup = BeautifulSoup(response, 'html.parser')
    ipaddress = soup.find_all('b')[0].find("span").text
    ip_list = [" 127.0.0.1 ","1.204.29.177"]
    if ipaddress in ip_list:
        print("合法登录")
    else:
        print("非法登录")


getIP()  

PHP

      $url = "#34;;
        $content = file_get_contents($url);
        $data = explode("=",$content);
        $str =  substr ($data[1],0, strlen ($data[1])-1);
        $ip_str = explode(",",$str)[0];
        $ip_str = explode(":",$ip_str);
        $visitor_ip = explode('"',$ip_str[1])[1]; # 访问者ip
        
        # 获取ip库
        $ file name = "ip_list.txt";
        $arr = array();
        if (0 < filesize($filename)){
            $handle = fopen($filename, "r");//读取二进制文件时,需要将第二个参数设置成'rb'
        
             //通过filesize获得文件大小,将整个文件一下子读到一个字符串中
            $contents = fread($handle, filesize ($filename));
             fclose ($handle);
            $arr = explode("\r\n",trim($contents,"\r\n"));
        }
        
        
        if (in_array($ visitor _ip,$arr) || 0 == count($arr)){
              echo  "合法";
        }else{
             echo "非法";
        }  

文章来源:智云一二三科技

文章标题:PHP&Python获取当前网络外网ip地址

文章地址:https://www.zhihuclub.com/79461.shtml

关于作者: 智云科技

热门文章

评论已关闭

38条评论

  1. The Tehachapi Wine and Cattle Company has produced a rich, full bodied wine of exceptional character

  2. Looking at what causes erectile dysfunction has been the most important determining factor in BlueChew s approach to helping impotency

  3. More recently, several SSRIs other than dapoxetine have been used off-label to treat PE

  4. But I suspect, from what I ve seen in her care, that she probably wouldn t consider just randomly prescribing drugs to you.

  5. Being consistent with this, qRT PCR analysis showed that tamoxifen treatment for 7 days significantly increased HOTAIR lncRNA levels in both MCF7 and T47D cells, while dramatically decreasing the expression of GREB1, a known ER induced gene Figure 1D E

  6. In patients with very advanced cases of cervical cancer, the goal of treatment is to ease pain or symptoms, rather than trying to cure their disease

  7. is aralen chloroquine 200mg 60 tablets can i take mucinex d with aralen where can i get aralen These data provide a mechanistic basis for the differential expression of SULT1A1 in different tissues and different physiological states of disease

  8. Cycloheximide or puromycin drastically suppressed OHT induced CSR in AID ER expressing AID B cells when added 1 h before OHT but not after OHT, suggesting that de novo protein synthesis is required for an event downstream to AID expression in CSR

  9. Can I stop you for a second Further studies in human populations from different ethnic groups are warranted to establish whether the genotype at the 3 BCL11B locus may be used as diagnostic biomarker to identify individuals at increased risk of developing arterial stiffness and other vascular diseases

  10. For more information on male breast reduction surgery or gynecomastia, give Wall Street Cosmetic Surgery a call at 212 344 0496 or visit us online

  11. A high AR ERО± or PDEF ERО± ratio predicts a sub optimal response to tamoxifen therapy in ERО± positive breast cancer

  12. Dx 3 13 2013, IDC, Grade 3, ER PR, HER2 Surgery 4 9 2013 Mastectomy Right Chemotherapy 5 5 2013 Cytoxan cyclophosphamide, Taxotere docetaxel Hormonal Therapy 9 14 2013 Tamoxifen pills Nolvadex, Apo Tamox, Tamofen, Tamone Dx 10 13 2017, Stage IV, metastasized to bone liver lungs, Grade 3, ER PR, HER2 Chemotherapy 10 27 2017 Taxol paclitaxel Hormonal Therapy 1 5 2018 Faslodex fulvestrant Targeted Therapy 1 8 2018 Verzenio Chemotherapy 6 1 2018 Xeloda capecitabine Targeted Therapy 11 7 2018 Afinitor everolimus Chemotherapy 11 8 2018 Carboplatin Paraplatin Chemotherapy 3 29 2019 AC Chemotherapy 8 19 2019 Halaven eribulin

  13. com 20 E2 AD 90 20Viagra 20Ablaufdatum 20 20Effets 20Viagra 20Dure effets viagra dure Police say that Pietz was unhappy with his marriage and was having affairs, a claim that was backed up by the testimony of one of NicoleГў s co workers, who said Nicole came to work in tears the morning before her disappearance

  14. Misalkan Anda tidak memiliki resep untuk obat yang Anda butuhkan, seperti kontrasepsi atau antibiotik

  15. Mallucci GR RattГ© S Asante EA et al Since chemo thru me into a early menapause, I was not concern with hotflashes side effect since Im already going thru them, but I was very worried about the cervicle cancer part

  16. tegretol telmisartan donde comprar While weekly initial claims for state unemployment benefitsclimbed 13, 000 to 336, 000 just above the level expected byeconomists in a Reuters poll the four week moving average fellto its lowest level since November 2007

  17. According to a specific embodiment, an increase in responsiveness as compared to a non responsive control is of at least 10, 20, 30, 40, 50, 60, 70, 80, 90 or more

  18. Validated IHC is the recommended standard test for predicting benefit from endocrine therapy

  19. Additionally, alcohol and caffeine, as well as spicy foods, are among the substances that may irritate the bladder and, thus, should be avoided

  20. Studies in breast cancer have suggested that vitamin D dependant radiosensitization is mediated through autophagy, while autophagy has demonstrated both radiosensitizing and dampening effects in malignant gliomas 158 160

  21. A couple who have already given birth without the use of medical support or fertility medications finds themselves unable to get pregnant or experiences recurrent miscarriages and They have been trying for one year if the woman is less than 35 or They have been trying for 6 months if the woman is older than 35 Excision Poor with chemotherapy metastasis if there is metastasis

  22. Keeping up to be immunogenic Estrogen receptor alpha and progesterone receptor expression in ovarian adult granulosa cell tumors and Sertoli Leydig cell tumors

  23. B Appearance of ears top row and skin bottom row Case law has established that the courts will not permit a dismissal to be disguised as termination of the contract through mutual agreement

  24. Through friends nathan pharmacy Horta Osorio said I believe this reflects the hard workundertaken over the last two years to make Lloyds a safe andprofitable bank that is focused on supporting the UK economy, Horta Osorio said Am J Kidney Dis 48 8 20, 2006

  25. Location TowneBank Stadium, Virginia Furthermore, it was deficits on these two indirect tasks, rather than deficits on the more direct story comprehension task, that predicted poor insight

网站地图