DynDNS.class update



  • Added his function to get the WAN IP (Internet) regardless of setting.
    Code:

    /*
          * Private Function (added 07 July 08)
                  * - Get the WAN IP
                  */
    function _checkIP() {

    log_error("DynDns: _checkIP() starting.");

    $ip_ch = curl_init('http://checkip.dyndns.org');
    curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    $ip_result_page = curl_exec($ip_ch);
    $ip_result_decoded = urldecode($ip_result_page);
    preg_match('=Current IP Address: (.*)=siU', $ip_result_decoded, $matches);
    $ip_address = trim($matches[1]);

    log_error("DynDns debug information: {$ip_address}");

    return $ip_address;
    }

    Changed the $wan_ip lines in these two functions.
    Code:

    function _detectChange() {

    log_error("DynDns: _detectChange() starting.");

    $currentTime = time();

    $wan_ip = $this->_checkIP();

    Code:

    function _checkStatus($data) {
    log_error("DynDns: DynDns _checkStatus() starting.");
                            .
                            .
                            .
    if($successful_update == true) {
    /* Write WAN IP to cache file */
    $wan_ip = $this->_checkIP();

    I hope this helps anyone habing trouble using the dyndns behind a NAT.

    Hai om2 semua, aku mau edit seperti petunjuk diatas tapi aku nda tau nama file nya apa yah….???



  • /etc/inc/dyndns.class



  • thanks om grage…...


Log in to reply