[php] <?php function url($target = '') { $server = '192.168.1.1'; // IP address $host = '192.168.1.1'; // Domain name $port = 80; //端口 $referer = 'http://' . $host . $target; // Referer $username = "root"; #ADSL的路由的用戶名 $password = "routermanage"; #ADSL的路由的管理密碼 $authorization = base64_encode ( $username . ":" . $password ); $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: Close\r\n\r\n"; fputs ( $File, $out ); $makeFile = $buffer = ""; while ( $buffer = fread ( $File, 4096 ) ) { $makeFile = $makeFile . $buffer; } fclose ( $File ); } else exit ( "我靠,不行嗎" ); } url ( "/userRpm/PPPoECfgRpm.htm?Disconnect=斷%20線" ); //這里的路徑根據(jù)路由器的不同而變換 echo "已經(jīng)斷了"; ?> [/php]
發(fā)表評論