Use PHP to operate a vro

Source: Internet
Author: User
We often encounter the need to automatically change the IP address, for example, simulate click voting, data collection of blocked IP addresses, Alexa cheating, and so on, that is, we need to change the IP address frequently, we can use PHP to control the router to change the IP address, so that we don't need to be so tired of using the press Key wizard. Haha. Some routers provide router configuration management through WEB, with one

We often encounter the need to automatically change the IP address, for example, simulate click voting, data collection of blocked IP addresses, Alexa cheating, and so on, that is, we need to change the IP address frequently, we can use PHP to control the router to change the IP address, so that we don't need to be so tired of using the press Key wizard. Haha. Some routers provide router configuration management through WEB, with one

We often encounter the need to automatically change the IP address, for example, simulate click voting, data collection of blocked IP addresses, Alexa cheating, and so on, that is, we need to change the IP address frequently, we can use PHP to control the router to change the IP address, so that we don't need to be so tired of using the press Key wizard. Haha.
Some routers provide WEB-based router configuration management. One feature in the middle is disconnection and reconnection. We can use this feature. For more information, see the code below:

Function router ($ target = ''){

$ Server = '192. 168.1.1 '; // IP address
$ Host = '1970. 168.1.1 '; // Domain name
$ Port = 80;
$ Referer = 'HTTP: // '. $ host. $ target; // Referer
$ Username = "admin"; # username of the ADSL route
$ Password = "admin"; # The management password of the ADSL route
$ Authorization = base64_encode ($ username. ":". $ password); // echo $ authorization; exit ();
$ File = fsockopen ($ server, $ port, $ errno, $ errstr, 30 );
If ($ File ){
$ Out = "GET $ target HTTP/1.1 \ r \ n ";
$ Out. = "Host: $ host \ r \ n ";
$ Out. = "Referer: $ referer \ r \ n ";
$ Out. = "Authorization: Basic $ authorization \ r \ n ";
$ Out. = "Connection: Closern \ r \ n ";
Fputs ($ File, $ out );
$ MakeFile = $ buffer = "";
While ($ buffer = fread ($ File, 4096 )){
$ MakeFile = $ makeFile. $ buffer;
}
Fclose ($ File );
}
}


Router ("/userRpm/StatusRpm.htm? Disconnect = % B6 % CF % 20% CF % DF & wan = 1 ");



// Add php below to obtain the IP address of the current Gateway

Function getIP (){
$ Target = "/userRpm/StatusRpm.htm ";
$ Server = '192. 168.1.1 '; // IP address
$ Host = '1970. 168.1.1 '; // Domain name
$ Port = 80;
$ Referer = 'HTTP: // '. $ host. $ target; // Referer
$ Username = "admin"; # username of the ADSL route
$ Password = "admin"; # The management password of the ADSL route
$ Authorization = base64_encode ($ username. ":". $ password); // echo $ authorization; exit ();
$ File = fsockopen ($ server, $ port, $ errno, $ errstr, 30 );
If ($ File ){
$ Out = "GET $ target HTTP/1.1 \ r \ n ";
$ Out. = "Host: $ host \ r \ n ";
$ Out. = "Referer: $ referer \ r \ n ";
$ Out. = "Authorization: Basic $ authorization \ r \ n ";
$ Out. = "Connection: Closern \ r \ n ";
Fputs ($ File, $ out );
$ MakeFile = $ buffer = "";
While ($ buffer = fread ($ File, 4096 )){
$ MakeFile = $ makeFile. $ buffer;
}
Fclose ($ File );
}
// Match the current Gateway
$ Pattern = "/\" [A-Z0-9] {2} \-[A-Z0-9] {2} \-[A-Z0-9] {2} \-[A-Z0-9] {2 }\-[ a-Z0-9] {2} \-[A-Z0-9] {2 }\", \ "([0-9 \.] +) \ "/s ";
If (preg_match_all ($ pattern, $ makeFile, $ match )){
$ NowIP = $ match [1] [1];
}
Return $ nowIP;
}

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.