CTphpnwb's Profile User Rating: *****

Reputation: 2984 Guru
Group:
Mentors
Active Posts:
10,326 (4.63 per day)
Joined:
08-August 08
Profile Views:
59,489
Last Active:
User is offline Today, 07:53 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Mac
Favorite Browser:
Safari
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Toyota
Dream Kudos:
350
Expert In:
PHP

Latest Visitors

Icon   CTphpnwb has not set their status

Posts I've Made

  1. In Topic: PHP with SSH2 and realtime log capture

    Posted 18 Sep 2014

    Using code tags, just as they're described in the input window:
    	public function siptrace($num) {
    
    		if(is_numeric($num)) {
    		
    			if($ssh = ssh2_connect('localhost', 3972)) {
    			
    				if(ssh2_auth_password($ssh, 'user', 'password')) {
    				
    					$stream = ssh2_exec($ssh, 'log '.$num);
    					
    					stream_set_blocking($stream, true);
    					
    					while (ob_get_level() > 0) {
    
    						ob_end_clean();
    						
    					}
    	
    					sleep(1);
    					
    					while($line = fgets($stream)) {
    					
    						echo $line . "<br>";
    						
    					}
    					
    				}
    				
    			}
    		
    		}
    
    	}
    
    

    Some things you need to answer:
    Is $num numeric?
    Does if($ssh = ssh2_connect('localhost', 3972)) { return true?
    See where I'm going with this? You need to check each step along the way until you find a problem.
  2. In Topic: Thoroughly confused with PHP

    Posted 18 Sep 2014

    PHP is a server side language, so you can't simply open the file. You must request the file through the server:
    http://localhost/path/to/file
    Not: file:///Path/to/file
  3. In Topic: Mode of sorted array

    Posted 18 Sep 2014

    If you found the problem then how could you possibly need us to tell you where it is? If you put half as much energy into debugging as you put into getting others to do your work for you, you'd be done by now.
  4. In Topic: Why is my second function not returning a value?

    Posted 17 Sep 2014

    Two reasons.
    • Because it's declared void.
    • Because it contains no return.
  5. In Topic: Mode of sorted array

    Posted 17 Sep 2014

    View PostKrisna99, on 17 September 2014 - 10:32 AM, said:

    I've found the solution but the code seems strange logically. Can you tell me the logic behind this?

    Your problem is that you found the code but you should have written it yourself. If you had then you would know its logic. Copy/paste programming does not work. In fact, it practically guarantees failure.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Interests:
Looking for php programming work.
Years Programming:
34
Programming Languages:
Experience is important, yet at the same time it's over-rated.

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    CTphpnwb Icon

    31 Mar 2010 - 18:50
    Please post programming questions in the appropriate forums.
Page 1 of 1