Determine the pv and alexa ranking shell of the website

Source: Internet
Author: User

This is a script written to a friend. It is used for cdn and is often used for attacks. However, the domain name cannot be blocked once an attack is encountered. We can choose to make a decision.


This is the value of alexa in php.

<? Php $ yuming = $ argv [1]; // obtain the alaxe ranking function getAlexaRank ($ domain = "www.cninfo360.com") {$ line = ""; $ data = ""; $ url = "http://data.alexa.com/data? Cli = 10 & dat = snba & ver = 7.0 & url = ". $ domain; $ fp = fopen ($ url, "r"); if ($ fp) {while (! Feof ($ fp) {$ line = fgets ($ fp); $ data. = $ line;} $ p = xml_parser_create (); xml_parse_into_struct ($ p, $ data, $ vals); xml_parser_free ($ p); for ($ I = 0; $ I <count ($ vals); $ I ++) {if ($ vals [$ I] ["tag"] = "POPULARITY ") {return $ vals [$ I] ["attributes"] ["TEXT"] ;}}} echo getAlexaRank ($ yuming);?>


This is used to obtain the pv value.

<? Php /// specify the address for passing the parameter // if (empty ($ argv [1]) {die ('parameter error ');} else {$ domain = $ argv [1];} // curl request // $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL ," http://alexa.cn/api0523.php ");//? Curl_setopt ($ ch, CURLOPT_POST, 1); $ data ['url'] = $ domain; $ data ['sig '] = 'd665053d27996bc7c72eff5f70d4facc '; $ data ['keyt'] = '000000'; curl_setopt ($ ch, CURLOPT_COOKIE, 'checkdom = '. $ domain); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); $ resp = curl_exec ($ ch); curl_close ($ ch ); $ array_div = explode ('*', $ resp); $ c = count ($ array_div); // parse the output // for ($ I = 0; $ I <$ c; $ I ++) {if ($ I = 10 | $ I = 12 | $ I = 14) {$ m = $ I + 1; if ($ array_div [$ I]! = "-") {$ As = intval (str_replace (',', '', $ array_div [$ I]); $ ax = intval (str_replace (',', '', $ array_div [$ m]); echo $ as * 3000 * $ ax; echo" \ n ";}else {echo "-"; echo "\ n ";}}}


Shell judgment


#!/bin/bashdigstatus=`dig $1 ns|grep IN.*NS.*.$|grep -E "ns1.appleidc.com|ns2.appleidc.com"|wc -l`[ $digstatus -eq 0 ] && exitpaiming=`php alexa $1`if [ $paiming -lt 1000 ]thenecho highelseecho no highfipv=`php pv $1`echo "$1 pv num is $pv"

After determining what to do, you can write it yourself. A friend executes a post form and adds a status value to the domain name in the database.

This article is from "Fengyun, it's her ." Blog, please be sure to keep this source http://rfyiamcool.blog.51cto.com/1030776/1087560


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.