Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Echo new lines from $var.
Old 12-22-2009, 10:13 AM Echo new lines from $var.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Hi Guys,

Me again

Im playing with telnet and the below script:

Anyway..
The output can sometimes have newlines ( like the comment below )

How can i echo the new lines from $result and not just the first line?

PHP Code:

<?php
require_once "PHPTelnet.php";

 
$telnet = new PHPTelnet();

 
// if the first argument to Connect is blank,
// PHPTelnet will connect to the local host via 127.0.0.1
$result $telnet->Connect('www.somewhere.com','login name','password');

 if (
$result == 0) {       $telnet->DoCommand('enter command here'$result);
    
// NOTE: $result may contain newlines
    
echo $result;
    
$telnet->DoCommand('another command'$result);
    echo 
$result;
    
// say Disconnect(0); to break the connection without explicitly logging out
    
$telnet->Disconnect();   }
?>
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
 
Register now for full access!
Old 12-22-2009, 11:31 AM Re: Echo new lines from $var.
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You mean for html output? You could use:
echo nl2br($result);
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Echo new lines from $var.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.38651 seconds with 12 queries