Page 1 of 1

Php echo length problem

Posted: Tue Jul 11, 2006 9:25 am
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.

Posted: Tue Jul 11, 2006 9:56 am
by Luke
Probably should have posted this in the PHP forum.

Posted: Tue Jul 11, 2006 10:15 am
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.

Posted: Tue Jul 11, 2006 10:30 am
by JayBird
Moved to PHP - Code

Posted: Wed Jul 12, 2006 12:25 am
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.

Posted: Wed Jul 12, 2006 12:29 am
by RobertGonzalez
Can you post some of you code? Other than the few lines that you have already posted?

Posted: Wed Jul 12, 2006 12:59 am
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.

Posted: Wed Jul 12, 2006 1:54 am
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..

Posted: Wed Jul 12, 2006 2:04 am
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.

Posted: Wed Jul 12, 2006 11:46 pm
by sheshu
Any solution for disabling this length printing?

Thanks & Regards,
Sheshu Kumar Inguva.