For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > August 2006 > removing odd characters after socket_read









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author removing odd characters after socket_read
Max

2006-08-28, 6:57 pm

I'm having a major issue in which I am reading data from a telnet
server with socket_read, and the data apears to be coming back with
what seems like either line feeds that stay on the same line or
left-arrow characters. I can't really figure out what is coming back,
so I'm not sure how to parse it out. If I simply dispay it on a web
page, it works, but if I try to feed it through an ajax call, it prints
the first line, then stops. I'm sure this is because it line feeds on
the same line or something. Also, I cannot do proper regex matching on
the lines as well.

Is there anything in PHP that can clean up these lines? Or would I have
to build a preg_match statement and only allow letters and punctuation?

Thanks,
Max

Max

2006-08-28, 6:57 pm

Well I may have solved the problem myself. A simple trim seemed to
clear it up as all the strange characters seem to be at the beginning
of the string.

Max

Max wrote:
> I'm having a major issue in which I am reading data from a telnet
> server with socket_read, and the data apears to be coming back with
> what seems like either line feeds that stay on the same line or
> left-arrow characters. I can't really figure out what is coming back,
> so I'm not sure how to parse it out. If I simply dispay it on a web
> page, it works, but if I try to feed it through an ajax call, it prints
> the first line, then stops. I'm sure this is because it line feeds on
> the same line or something. Also, I cannot do proper regex matching on
> the lines as well.
>
> Is there anything in PHP that can clean up these lines? Or would I have
> to build a preg_match statement and only allow letters and punctuation?
>
> Thanks,
> Max


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com