undefined method createConnection()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    undefined method createConnection()

    hello, i tried this class

    PHP Code:
    <?php
    
    class gombile
    { 
    
    var $serverHost = "gateway.mig33.com"; 
    var $serverPort = 25; 
    var $filePath = "/member2/t.php";
    var $username = null;
    var $userdef = "cah_gombile";
    var $_cookie = null;
    var $fp_handle = null;
    var $_respon = null;
    var $_debug = true;
    var $_debugMsg = array();
    var $inRoom = false;
    var $isPV = false; 
    var $startKick = false;
    var $kickMe = false; 
    
    function Login($usr, $pwd, $rem=false, $inv=false, $ret=false){
    $cookie = is_null($this->_cookie)?"": $this->_cookie; 
    $usr = urlencode($usr);
    $pwd = urlencode($pwd);
    
    $params = "cmd=login&username=$usr&password=$pwd"; 
    $params .= ($rem === true?"&rememberName=on":"");
    $params .= ($inv === true?"&invisible=on":""); 
    
    
    $this->_createConnection('POST', $this->filePath, $cookie, null, $params, false, false); 
    $Cookies = array(); 
    
    if($this->fp_handle) {
    while(!feof($this->fp_handle)){
    
    $respon = @fgets($this->fp_handle, 4096);
    $this->_respon .= $respon; 
    
    $isCookie = stristr($respon, "set-cookie");
    if($isCookie) {
    $Cookies[] .= trim(str_ireplace("set-cookie: ", "", $isCookie)); 
    }
    }
    }else{
    $this->_debugMsg[] .= "<span>Sorry, we couldn't connect to the mig33
    server. This is out of our control.</span>";
    }
    }
    }
    
    ?>
    
    
    <?php
    
    $usr="username"; 
    $pwd="password"; 
    
    $log=new gombile; 
    
    echo $log->Login($usr, $pwd, false, false, false);
    
    ?>
    I got this error
    Fatal error: Call to undefined method gombile::_createConnection() in / home/u338851794/public_html/
    mig/class.php on line 33

    I googled it and find nothing..
    Please how to solve this error
    **its yunas class**
    Thanks

    #2
    here is the fully class but its showing a blank page please i tired searching and trying someone help please

    PHP Code:
    <?php
    
    class gombile
    { 
    
    var $serverHost = "gateway.mig33.com"; 
    var $serverPort = 25; 
    var $filePath = "/member2/t.php";
    var $username = null;
    var $userdef = "cah_gombile";
    var $_cookie = null;
    var $fp_handle = null;
    var $_respon = null;
    var $_debug = true;
    var $_debugMsg = array();
    var $inRoom = false;
    var $isPV = false; 
    var $startKick = false;
    var $kickMe = false; 
    
    function _createConnection($method = 'GET', $file = '/', $referer = null,
                            $cookie = null, $content = null, $close = true)
       {
          $this->fp_handle = @fsockopen ($this->serverHost, 80, $errno, $errstr, 100);
          if(!$this->fp_handle) {
             exit("can not connect to $this->serverHost");
          }
          
          $method = strtoupper($method);
          if(!in_array($method, array('GET', 'POST')) || is_null($content)) {
             $method = 'GET';
          }
          
          if(is_null($referer)) {
             $referer = $this->serverHost;
          }
          
          if(is_null($cookie)) {
             $cookie = $this->_cookie;
          }
          
          $data = "$method $file HTTP/1.1\n";
          $data.= "Accept: */*\n";
          $data.= "Accept-Language: fa\n";
          $data.= "Referer: $referer/\n";
          $data.= "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\n";
          $data.= "Accept-Encoding: gzip, deflate\n";
          $data.= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser [avantbrowser.com]; .NET CLR 1.1.4322)\n";
          $data.= "Host: $this->serverHost\n";
          $data.= "Connection: Keep-Alive\n";
          $data.= "Cache-Control: no-cache\n";
          $data.= "Cookie: $cookie\n";
          
          if($method == 'POST') {
             $length = strlen($content);
             $data.= "Content-Length: $length\n\n";
             $data.= $content;
          } else {
             $data.= "\n";
          }
          
          @fputs ($this->fp_handle, $data);
          if($close) @fclose($this->fp_handle);
       }
    
    function Login($usr, $pwd, $rem=false, $inv=false, $ret=false){
    $cookie = is_null($this->_cookie)?"": $this->_cookie; 
    $usr = urlencode($usr);
    $pwd = urlencode($pwd);
    
    $params = "cmd=login&username=$usr&password=$pwd"; 
    $params .= ($rem === true?"&rememberName=on":"");
    $params .= ($inv === true?"&invisible=on":""); 
    
    
    $this->_createConnection('POST', $this->filePath, $cookie, null, $params, false, false); 
    $Cookies = array(); 
    
    if($this->fp_handle) {
    while(!feof($this->fp_handle)){
    
    $respon = @fgets($this->fp_handle, 4096);
    $this->_respon .= $respon; 
    
    $isCookie = stristr($respon, "set-cookie");
    if($isCookie) {
    $Cookies[] .= trim(str_ireplace("set-cookie: ", "", $isCookie)); 
    }
    }
    }else{
    $this->_debugMsg[] .= "<span>Sorry, we couldn't connect to the mig33
    server. This is out of our control.</span>";
    }
    }
    }
    
    ?>
    
    
    <?php
    
    $usr="username"; 
    $pwd="password"; 
    
    $log=new gombile(); 
    echo $log->Login($usr, $pwd, $rem=false, $inv=false, $ret=false);
    
    ?>

    Comment


      #3
      Create a function createConnection() inside the gombile class and i guess that method will be creating connection to a database
      libra.wen.ru

      Comment


        #4
        @s3nzo its already on it, check carfully

        Comment


          #5
          Originally posted by atef View Post
          here is the fully class but its showing a blank page please i tired searching and trying someone help please
          Try putting this at top of page to show your error:
          PHP Code:
          error_reporting  (E_ALL);
          ini_set ('display_errors', true); 
          

          Comment


            #6
            Check parameters for method, you are passing 7 params where definition has only 6!
            Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

            Comment


              #7
              thanks something else i added the code but it still a blank page.

              Comment


                #8
                because you are ECHOing the response from Login method, and Login method doesn't return anything!
                Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

                Comment


                  #9
                  but the class is not working bro. Thats why i posted it...

                  Comment


                    #10
                    Have you tried changing this:
                    Originally posted by ksg91 View Post
                    Check parameters for method, you are passing 7 params where definition has only 6!
                    eg:
                    change:
                    PHP Code:
                    $this->_createConnection('POST', $this->filePath, $cookie, null, $params, false, false); 
                    
                    to:
                    PHP Code:
                    $this->_createConnection('POST', $this->filePath, $cookie, null, $params, false); 
                    

                    Comment


                      #11
                      @something yea i tried that bro
                      Hope someone gonna fix it

                      Comment


                        #12
                        Try with http here or what protocol is it:

                        PHP Code:
                        var $serverHost = "http://gateway.mig33.com"; 
                        
                        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                        Comment


                          #13
                          Dont hide all errors when debuging scripts,its better to some times hide only warnings since they dont stop the cript from executing,so use this
                          error_reporting("E^WARNING"); after the <?php tag in your page

                          Comment


                            #14
                            did you even read this?

                            Originally posted by ksg91 View Post
                            because you are ECHOing the response from Login method, and Login method doesn't return anything!
                            Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

                            Comment


                              #15
                              yeah, and i done my porject
                              Thank u guys!

                              Comment

                              Working...
                              X