PHP restarts the router to replace the IP address program

Source: Internet
Author: User

This article will introduce you to a new version of PHP to restart the vro to replace the IP address program. If you are interested in this, please refer to it. When collecting large volumes of data, the "self-protection" of the other server is often triggered, and access is restricted if the request is too frequent. In this case, the access can be restored after a long period of time (ranging from 10 minutes to dozens of minutes), so that the data collection speed is greatly limited. There are two solutions: 1. bypass the verification code mechanism through image recognition and tell the server: I am not a spider, I am a person. Look, I can understand the verification code. 2. Change the IP address and tell the server: I am not Michael Zhang, And I am Mr. Li. Believe it or not, look, my IP address is different from that of John. The first method is a little more difficult and unreliable. When the other server upgrades the verification code one day, it will have to be followed up. There is a lot of trouble, while ISP (China Telecom, China Unicom, and China Mobile) has a lot of IP addresses, A new IP address is assigned for each network connection. Therefore, method 2 is better. Take my TP-LINK router as an example, find "Network Parameters"> "WAN Port Settings", you can see the "Automatic Connection" settings and "disconnected" button. Each time you click the "disconnected" button, you can call the ISP again and change the IP address. However, the collection of large volumes of data takes a long time, and it is impossible for someone to keep it. It is best to restart the PHP code once it is found to be restricted, this will return to the topic of this article: "restart the router through PHP function to replace IP Address" Open the debugging mode of chrome browser, then click the "disconnected" button to view the "Network" Network request, the actual execution address is: "http: // 192.168.0.1/userRpm/PPPoECfgRpm.htm? Wantype = 2 & acc = 65541234 & psw = Hello123World & VnetPap = 0 & linktype = 2 & Disconnect = % B6 % CF + % CF % DF "and then simulate the request for this address, after testing, you can change the IP address (you can see the current IP address through http://api.akcms.com/myip.php ). The following is simple: PHP uses the Curl component to implement the request process. I encapsulate a function resetip. The specific code is as follows:

 
 
The Code is as follows: Copy code
<? Php // This script tests the restart of the WLAN connection resetip () of the vro; function resetip () {$ username = 'admin'; $ password = '123 '; $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, 'HTTP: // 192.168.0.1/userRpm/PPPoECfgRpm.htm? Wantype = 2 & acc = 65541234 & psw = Hello123World & VnetPap = 0 & linktype = 2 & Disconnect = % B6 % CF + % CF % DF '); curl_setopt ($ ch, CURLOPT_USERPWD, "$ username: $ password"); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_exec ($ ch); curl_close ($ ch);}?>
You need to modify the highlighted area according to your own situation. Some vro addresses are 192.168.1.1, And the restart addresses are also different, but they are similar and you need to modify them yourself.

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.