Re: [PHP] Re: socket programming

2003-07-16 Thread Michael P. Carel
 Quite a while ago now, I wrote a simple HTTP proxy in PHP that listens on
port
 4887 by default. It is a single script, so it is pretty easy to follow,
and
 you're welcome to check it out at http://protoscope.org/. It is probably a
 better example than I could come up with here.

I've downloaded your scripts and tried to test it on my server. Please
correct me if im doing it right.
I've opened services and port from the server to automatically run
protoscope only  during  acces in the given port (http:\\myserver.com:4887)
:

inetd.conf:
protoscope stream  tcp nowait.1000 root.root
/usr/local/mikecarel/protoscope.php

services:
protoscope 4887/tcp

My question's are :
1. How could i access the rest of my php script residing in
/usr/local/mikecarel/ (http://myserver.com:4887/index.php) ?
2. If ever does the POST and GET method works properly on this?
3. Do I still need to install apache?

Hope I understand your application correctly.



Mike


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



Re: [PHP] Re: socket programming

2003-07-16 Thread Chris Shiflett
--- Michael P. Carel [EMAIL PROTECTED] wrote:
 I've downloaded your scripts and tried to test it on my server.
 Please correct me if im doing it right. I've opened services and
 port from the server to automatically run protoscope only during
 acces in the given port (http:\\myserver.com:4887)

I always just leave it running when I use it, but your method would probably
work as well.

 My question's are :
 1. How could i access the rest of my php script residing in
 /usr/local/mikecarel/ (http://myserver.com:4887/index.php)?

Well, I meant this as a simple example of socket programming in PHP more than
anything. Since the application is an HTTP proxy, you would set up your browser
to use a proxy (specifying the host and port Protoscope is running on), and
then just type http://myserver.com/index.php in your browser's location bar
(assuming a Web server is running on myserver.com).

The method you mention makes the browser think it is contacting an HTTP server,
which is a bit different, so that wouldn't work.

 2. If ever does the POST and GET method works properly on this?

Yes, but only as an HTTP proxy.

 3. Do I still need to install apache?

If you want to connect to myserver.com and have it handle HTTP requests, then
you will need a Web server. If this is what you're looking for, you might be
interested in another PHP project called Nanoweb, which is a Web server written
in PHP. Because this task is much more complicated, the project is more
complicated as well, so it may not be the best learning example. You can learn
more about it here:

http://nanoweb.si.kz/

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Re: socket programming

2003-07-16 Thread Jason Wong
On Wednesday 16 July 2003 08:19, Michael P. Carel wrote:

 Actually i want to create a server utility that can be administered through
 web via a certain port, i'm afraid not to use php as an apache module
 because the server might have an existing webserver installed, so i came
 out into an idea to use php cgi/cli to run in a specified port and view it
 in the web. It is somewhat similar to some existing utilities such as
 WEBMIN which use perl cgi, but i really dont have a very good start since i
 dont have enough examples for this. I've already opened opened port for
 this as what David said  but i cant see the output in the web.

There is a project which actually implements a webserver using PHP. Have a 
search on freshmeat.net and/or sourceforge.net. It should give you enough 
inspiration to write your own server.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I find this corpse guilty of carrying a concealed weapon and I fine it $40.
-- Judge Roy Bean, finding a pistol and $40 on a man he'd
   just shot.
*/


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



Re: [PHP] Re: socket programming

2003-07-16 Thread Michael P. Carel
 http://nanoweb.si.kz/
 
thanks for this link, it will helps me alot.

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



Re: [PHP] Re: socket programming

2003-07-15 Thread Michael P. Carel
  Hi to all,
 
  Is it possible to run php in the web running in a specified port without
  installing apache in Linux?
 
  Can anyone give a sample code for this? I'm searching this for a week
but i
  really can find one. Please help us.
 
 
 
  Regards,
 
  Mike
 
 Do you mean to host websites with ONLY php and without webserver? Or do
 you mean using PHP for something else then web, to make it listen for
 incomming connections?

Actually i want to create a server utility that can be administered through
web via a certain port, i'm afraid not to use php as an apache module
because the server might have an existing webserver installed, so i came out
into an idea to use php cgi/cli to run in a specified port and view it in
the web. It is somewhat similar to some existing utilities such as WEBMIN
which use perl cgi, but i really dont have a very good start since i dont
have enough examples for this. I've already opened opened port for this as
what David said  but i cant see the output in the web.

He'res what i've did in my Redhat linux 6.x

inetd.conf:
samples stream  tcp nowait.1000 root.root
/usr/local/mikecarel/samples samples

services:
samples 6886/tcp

samples:
#!/usr/local/bin/php -q
?php
echo Content-Type: text/html;charset=iso-8859-1;
echo \n;
echo htmlhello /html;
?

Am I in a right track? or is it possible with this? Do i missed something
here?

Thanks in advance.


Mike



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



Re: [PHP] Re: socket programming

2003-07-15 Thread Chris Shiflett
--- Michael P. Carel [EMAIL PROTECTED] wrote:
 Actually i want to create a server utility that can be
 administered through web via a certain port, i'm afraid not
 to use php as an apache module because the server might have
 an existing webserver installed, so i came out into an idea
 to use php cgi/cli to run in a specified port and view it in
 the web.

This is pretty easy to do, but I should warn that PHP's socket support is still
labeled as experimental, though I have found it to be very stable, and I know
of no plans to change the API.

Quite a while ago now, I wrote a simple HTTP proxy in PHP that listens on port
4887 by default. It is a single script, so it is pretty easy to follow, and
you're welcome to check it out at http://protoscope.org/. It is probably a
better example than I could come up with here.

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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