Php echo length problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sheshu
Forum Newbie
Posts: 5
Joined: Tue Jul 11, 2006 9:11 am

Php echo length problem

Post by sheshu »

Hi,

I have a problem with echo in PHP. When i am trying to print some status its printing length of that string before printing actual text.

I am using

echo "&P=1&Z=Description"
and its printing

12
&P=1&Z=Description


Here 12 is in hexa (18 Decimal) representing 18 chars printing.

I am using PHP version 4.3.2 .
I am using raw TCP socket connection with PHP on port 80 with web server. (Not using HTTP parsers/library)

For disabling this length printing is there any settings I need to change?

Pls Help me.

Thanks & Regards,
Sheshu Kumar Inguva.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Probably should have posted this in the PHP forum.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Try using single quotes instead of double quotes and see what that does. Also, make sure the strlen count is not being echo'ed from another output somewhere else in the script.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Moved to PHP - Code
sheshu
Forum Newbie
Posts: 5
Joined: Tue Jul 11, 2006 9:11 am

Post by sheshu »

I tried with single quotes, but its still printing number of chars . Its comming for every echo. we can clearly see in ethereal but not on browser. Is there any setting in php to stop this? or is there any functions to print only chars required without length of chars?

Thanks & Regards,
Sheshu Kumar Inguva.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Can you post some of you code? Other than the few lines that you have already posted?
sheshu
Forum Newbie
Posts: 5
Joined: Tue Jul 11, 2006 9:11 am

Post by sheshu »

These are three echos I am using

echo "<Z>R=" . $userStatus . "&E=" . date("mdy", $AppTableRow[0]);
echo "&P=" . CURRENT_APP_VERSION . "&Z=" . CURRENT_APP_DESC;
echo "</Z>";


output of these three echos in ethereal stream dump

f
<Z>R=6&E=081106
12
&P=1&Z=Description
4
</Z>



Before printing Echo text, it’s printing length of text. And I want to eliminate this length printing.


Thanks & Regards,
Sheshu Kumar Inguva.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Doesn't ethereal print the length of the transmission? So, in other words, it's nothing to do with PHP and isn't a 'fault' as such?

It has been a while since I used Ethereal mind..
sheshu
Forum Newbie
Posts: 5
Joined: Tue Jul 11, 2006 9:11 am

Post by sheshu »

This is not ethereal decoding, Its stream view of all tcp packets(Right click-> Follow tcp stream). where ethereal will not write its material. And i am getting this in reading stream with my client. This is generated by php only.

With telnet also i am getting this length before string!

Thanks & Regards,
Sheshu Kumar Inguva.
sheshu
Forum Newbie
Posts: 5
Joined: Tue Jul 11, 2006 9:11 am

Post by sheshu »

Any solution for disabling this length printing?

Thanks & Regards,
Sheshu Kumar Inguva.
Post Reply