php-general Digest 5 Feb 2007 02:11:52 -0000 Issue 4608

Topics (messages 248277 through 248296):

Peristent Listen over an HTTP connection
        248277 by: chetan rane
        248279 by: Stut
        248283 by: chetan rane
        248285 by: Stut
        248286 by: Jiffy Slides Leonard Burton
        248287 by: Stut
        248289 by: chetan rane
        248290 by: Stut
        248291 by: Myron Turner
        248292 by: Myron Turner

Re: Read file on file system
        248278 by: Stut
        248280 by: Satyam
        248281 by: Bagus Nugroho
        248282 by: Stut
        248284 by: Stut
        248288 by: Satyam

Hello list
        248293 by: PHP Fusebox

Sending secure mail
        248294 by: Rob
        248295 by: Chris

Re: Jabber conection manager
        248296 by: Le Phuoc Canh

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
HI all

I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. How do
i accomplish it

--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
            [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
chetan rane wrote:
I have a small issue to be handled here

i want to persistently moniter the HTTP stream from a Client Browser. How do
i accomplish it

I'm not sure what you mean by 'persistently monitor'. If you mean listen for incoming connections then you need to look at the socket or stream functions. If that is the case then I don't see where the "Client Browser" comes into it.

Please elaborate further on what you are actually trying to accomplish.

-Stut

--- End Message ---
--- Begin Message ---
hi

what i mean is

i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP
connection but use the existing TCP connection.

On 2/4/07, Stut <[EMAIL PROTECTED]> wrote:

chetan rane wrote:
> I have a small issue to be handled here
>
> i want to persistently moniter the HTTP stream from a Client Browser.
> How do
> i accomplish it

I'm not sure what you mean by 'persistently monitor'. If you mean listen
for incoming connections then you need to look at the socket or stream
functions. If that is the case then I don't see where the "Client
Browser" comes into it.

Please elaborate further on what you are actually trying to accomplish.

-Stut




--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
            [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
chetan rane wrote:
i want to write a script
where , when ny client requests come i read the stream and then process it

here is the exact steps

when the user first initiates
i create a session and establish a TCP connection
second: when teh user next sends a request i dont create a new TCP connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

--- End Message ---
--- Begin Message ---
XAJAX or another AJAX library, perhaps?

On 2/4/07, Stut <[EMAIL PROTECTED]> wrote:
chetan rane wrote:
> i want to write a script
> where , when ny client requests come i read the stream and then process it
>
> here is the exact steps
>
> when the user first initiates
> i create a session and establish a TCP connection
> second: when teh user next sends a request i dont create a new TCP
> connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

--- End Message ---
--- Begin Message ---
Jiffy Slides Leonard Burton wrote:
XAJAX or another AJAX library, perhaps?

Sorry, I missed a question.

3) Why do you need to use the same TCP connection?

-Stut

On 2/4/07, Stut <[EMAIL PROTECTED]> wrote:
chetan rane wrote:
> i want to write a script
> where , when ny client requests come i read the stream and then process it
>
> here is the exact steps
>
> when the user first initiates
> i create a session and establish a TCP connection
> second: when teh user next sends a request i dont create a new TCP
> connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--- End Message ---
--- Begin Message ---
same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.

On 2/4/07, Stut <[EMAIL PROTECTED]> wrote:

chetan rane wrote:
> i want to write a script
> where , when ny client requests come i read the stream and then process
it
>
> here is the exact steps
>
> when the user first initiates
> i create a session and establish a TCP connection
> second: when teh user next sends a request i dont create a new TCP
> connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut




--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
            [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
chetan rane wrote:
same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP connection to the SERVER.
and vice versa

i think this makes it clear.

OK, so you're basically making a server app. I suggest you start here: http://php.net/stream-socket-server

-Stut

--- End Message ---
--- Begin Message ---
chetan rane wrote:
same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.
I think what you want to look for is how to write a socket server. You'll find a lot about this via google. A socket server lets you open up a persistent port for listening with a process that runs continually in the background and then allows you to spawn off multiple sockets as they come in, like a web server or ftp or ssh. My guess is that there's a fair amount of complexity here that you'll have to investigate. For instance, you'll have to preempt port 80, the standard port on which httpd listens, forward the http request to your web server on a local port, retrieve the response and pass it back to the client. And presumably you'll have to be doing this for multiple clients. I think someone on this list suggested using AJAX. That would be much simpler. If you had to have data persistence, for instance, you could store data in temporary files on the server or in temporary database entries, or you could simply pass data back and forth using POST. The script which handles the AJAX requests would be the "component" that resides on the server.


_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--- End Message ---
--- Begin Message ---
chetan rane wrote:
same TCP creation,

because i i am bindiing that stream to the Server.

i am actually creating a component.

a component which resides in between a client and server

i accept HTTP requests from a client and relay the same uysing a TCP
connection to the SERVER.
and vice versa

i think this makes it clear.

On 2/4/07, Stut <[EMAIL PROTECTED]> wrote:

chetan rane wrote:
> i want to write a script
> where , when ny client requests come i read the stream and then process
it
>
> here is the exact steps
>
> when the user first initiates
> i create a session and establish a TCP connection
> second: when teh user next sends a request i dont create a new TCP
> connection but use the existing TCP connection.

Ok, couple of questions...

1) Why?
2) Why?

What is making these connections from the client side?

-Stut




As a follow-up to my previous, try this:
   http://www.devshed.com/c/a/PHP/Socket-Programming-With-PHP/

It needs IE (as opposed to Firefox).

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--- End Message ---
--- Begin Message ---
Bagus Nugroho wrote:
If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.

Well, from examining the code you included in your post, and reading the output you're seeing, I have determined that... ahh, hang on a second, I've started seeing code where no code exists. Is that a bad thing? Should I see someone?

-Stut

--- End Message ---
--- Begin Message --- Have you doubled the backslash to escape it? Or put it in between single quotes? Either:

"c:\\test.csv"  or 'c:\test.csv' or even 'c:/test.csv'

Otherwise, a \t in between double quotes will be interpreted as a tab

Satyam

----- Original Message ----- From: "Bagus Nugroho" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, February 04, 2007 2:47 PM
Subject: [PHP] Read file on file system


Hi All,

If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.

Thanks in advance
Regards,
bn

--- End Message ---
--- Begin Message ---
in simple like this
////////
$filename = "d:\\test.csv";
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile

....
or like this
.....

echo file_get_contents($openfile);

.....
echo fgetcsv($openfile);

////////

Thxs and rgds
bn



-----Original Message-----
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Sun 04-Feb-2007 21:14
To: Bagus Nugroho
Cc: [email protected]
Subject: Re: [PHP] Read file on file system
 
Bagus Nugroho wrote:
> If I have file on[windows] c:\test.csv.
> How I can read the entire contents of this file?
> 
> I have try file_get_contents, fgetcsv and etc but didn't work.
> May I'm mis-understanding about using those function.

Well, from examining the code you included in your post, and reading the 
output you're seeing, I have determined that... ahh, hang on a second, 
I've started seeing code where no code exists. Is that a bad thing? 
Should I see someone?

-Stut




--- End Message ---
--- Begin Message ---
Bagus Nugroho wrote:
in simple like this
////////
$filename = "d:\\test.csv";
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile

....
or like this
.....

echo file_get_contents($openfile);

.....
echo fgetcsv($openfile);

Try this...

<?php
    $filenane = "d:\\test.csv
    if (file_exists($filename))
        echo file_get_contents($filename);
    else
        echo 'File not found';
?>

...and nothing else. Do you get any errors? Are errors turned on in php.ini?

-Stut

--- End Message ---
--- Begin Message ---
Stut wrote:
    $filenane = "d:\\test.csv

Oops...

$filename = "d:\\test.csv";

-Stut

--- End Message ---
--- Begin Message --- file_get_contents takes a file name as an argument, not an opened file handle.


----- Original Message ----- From: "Bagus Nugroho" <[EMAIL PROTECTED]>
To: "Stut" <[EMAIL PROTECTED]>; <[email protected]>
Sent: Sunday, February 04, 2007 3:45 PM
Subject: RE: [PHP] Read file on file system


in simple like this
////////
$filename = "d:\\test.csv";
$openfile = fopen($filename,'r');
$readfile = fread($openfile,filesize($filename);

echo $readfile

....
or like this
.....

echo file_get_contents($openfile);

.....
echo fgetcsv($openfile);

////////

Thxs and rgds
bn



-----Original Message-----
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Sun 04-Feb-2007 21:14
To: Bagus Nugroho
Cc: [email protected]
Subject: Re: [PHP] Read file on file system

Bagus Nugroho wrote:
If I have file on[windows] c:\test.csv.
How I can read the entire contents of this file?

I have try file_get_contents, fgetcsv and etc but didn't work.
May I'm mis-understanding about using those function.

Well, from examining the code you included in your post, and reading the
output you're seeing, I have determined that... ahh, hang on a second,
I've started seeing code where no code exists. Is that a bad thing?
Should I see someone?

-Stut

--- End Message ---
--- Begin Message ---
I've tried subscribing 3 times now.
This is a test.

--- End Message ---
--- Begin Message ---
I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the "rcpt to:" line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the "auth login" command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing "smtp.example.com" to "tls://smtp.example.com" but
it then fails to connect at all ($errNo is "115", $errStr is "Operation
now in progress"). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and "rcpt to:" line and beyond?

Thanks,
Rob

--- End Message ---
--- Begin Message ---
Rob wrote:
I need to send a large number of emails (not spam!) through an external
SMTP server that requires TLS and a username/password. I have some
control over the SMTP server but very little over the web server where
the scripts reside. How do I connect with TLS, authenticate and send the
mail?

I had problems with mail() originally (one of the reasons why we now
have a dedicated mail server) and I had to connect to the SMTP server by
hand with sockets and go through the SMTP steps by hand. I can connect
to the new server with following code.

$sock = fsockopen( 'smtp.eg.com', 25, $errNo, $errStr );

However, when I send the "rcpt to:" line, I'm told I don't have access
to the relay - i.e. I need to log in. This is where my knowledge of SMTP
reaches it's limit but I've read about the "auth login" command,
however, it says it needs to be run over an encrypted connection, i.e.
TLS. I can't disable this on the server, other services need TLS to be
on the SMTP server.

I've tried changing "smtp.example.com" to "tls://smtp.example.com" but
it then fails to connect at all ($errNo is "115", $errStr is "Operation
now in progress"). If I connect and send starttls, I don't get any more
data from the server and I've no idea what it's waiting for, be it a
public key or whatever. FWIW, the email server's certificate is a dodgy,
home made one which throws up a security error when tested with a mail
client, but once accepted it is fine.

Is there an easier way to do this? If not, how do I get the connection
so I can get to and "rcpt to:" line and beyond?

My first suggestion, instead of writing this from scratch, use phpmailer (http://phpmailer.sf.net). It supports smtp authentication etc, see included docs and also http://phpmailer.sourceforge.net/docs/

If that's not an option for whatever reason, follow what that does with authentication and implement it in your own script.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
It seem that you want to develop a webchat :), today there is a lot library
about Jabber protocol, but all in JAVA language, if you want you can use
library of jivesoftware to develop. I use Wildfire for IM server, and Claros
for webchat in servlet. You can try it for develop Jabber connection manage.
Best Regard.

-----Original Message-----
From: chetan rane [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 03, 2007 10:07 PM
To: [email protected]
Subject: [PHP] Jabber conection manager

HI all

i want to develop a Jabber connection manage its role will be

1. accept HTTp request from the Client
2. establish connection with a jabber server using TCp 3. and later start
the instant mechanism between them

has any one worked on this please let me know how to do it


--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
             [EMAIL PROTECTED]

--- End Message ---

Reply via email to