Page 1 of 1
accessing remote server localhost
Posted: Thu Apr 06, 2006 3:58 pm
by ditu
hi there,
I am working on a project which involves Windows Media Service.
As we all know that WMS is less secure, so my project is to make sure that the
users are registered to my file server(sql database).
my WMS server is set to listen only to the local port(127.0.0.1:99).
is there any way to redirect users to that port/ip if he comes through my
php script?
i am trying to access remote server localhost from from the internet and
i think it is possible via php but when i try to redirect users to the localhost, the script points
to the client's localhost, not the remote server.
any help will be appreciated.

Posted: Thu Apr 06, 2006 4:17 pm
by feyd
seems to me that writing your script to act as a sort of proxy interface to the "remote" service would work just fine. I would likely use
fsockopen() unless there was some API I could already use..
Posted: Thu Apr 06, 2006 5:16 pm
by ditu
thanks for the prompt reply!
I was just wondering if you could guide me a bit further on it.
I have read the fsocketopen() function but I would appreciate a bit detailed help.
My dedicated server's media service listens to the localhost:99 and I am trying
to forward users from 222.222.222.222:80 to that local port. if I use udp protocol,
would that help me? as WMS can be bind to only http or mms or rtsp.
Thanks a million in advance!
Posted: Thu Apr 06, 2006 6:13 pm
by feyd
What sort of "detailed help" are you needing? I won't code it for you.
Posted: Thu Apr 06, 2006 6:28 pm
by ditu
hi,
no, i am not asking to code for me.
I was just wondering if you could tell me if the attempt is viable.
actually I am going to finish up with my project soon and wanted to
add this feature if possible.
Thanks for your help.
Posted: Thu Apr 06, 2006 6:32 pm
by feyd
whether your install supports rtsp, udp or whatever can be found by stream_get_transports(). As for "can it be done" sure, it's posslbe.. damn near anything is given enough knowledge of a system.
Posted: Fri Apr 07, 2006 3:34 am
by ditu
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi there,
thanks for your help.
my apache server is running on the same machine where i want to access the localhost.
the following code opens the tcp port 89 of 127.0.0.1
Code: Select all
<?php
$fp = fsockopen("http://127.0.0.1", 89, $errno, $errstr);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
fwrite($fp, "\n");
echo fread($fp, 26);
fclose($fp);
}
?>
how would I extend the port so that it points to a source. i.e.:
http://127.0.0.1:99/alpha
thanks
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Fri Apr 07, 2006 7:07 am
by feyd
The first example on the fsockopen() manual page shows a basic request to a http address.