Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hinet VDSL Wi-Fi AP D-Link WBR-2200 Auto Dial-Up / Hang-Up
<?php
/* For Hinet VDSL Wi-Fi AP D-Link WBR-2200 */
// Log in http://192.168.0.1 &
// Get UID in Cookie by Chrome DevTools
define('UID', 'ABCxyz1234');
function callService($data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING , 'gzip');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Host: 192.168.0.1',
'Connection: keep-alive',
'Content-Length: '. strlen($data),
'Pragma: no-cache',
'Cache-Control: no-cache',
'Origin: http://192.168.0.1',
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded',
'Accept: */*',
'DNT: 1',
'Referer: http://192.168.0.1/st_device.php',
'Accept-Encoding: gzip, deflate',
'Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4,zh-CN;q=0.2',
'COOKIE: uid=' . UID
));
curl_setopt($ch, CURLOPT_URL, 'http://192.168.0.1/service.cgi');
return curl_exec($ch);
}
function dialUp() {
callService('EVENT=WAN-1.PPP.DIALUP');
}
function handUp() {
callService('EVENT=WAN-1.PPP.HANGUP');
}
/*
dialUp();
sleep(60);
...
handUp();
sleep(60);
...
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.