accessing remote server localhost

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ditu
Forum Newbie
Posts: 7
Joined: Thu Apr 06, 2006 3:52 pm

accessing remote server localhost

Post 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. :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
ditu
Forum Newbie
Posts: 7
Joined: Thu Apr 06, 2006 3:52 pm

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What sort of "detailed help" are you needing? I won't code it for you.
ditu
Forum Newbie
Posts: 7
Joined: Thu Apr 06, 2006 3:52 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
ditu
Forum Newbie
Posts: 7
Joined: Thu Apr 06, 2006 3:52 pm

Post by ditu »

feyd | Please use

Code: Select all

,

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

,

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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The first example on the fsockopen() manual page shows a basic request to a http address.
Post Reply