Hi all,
I was wondering if anyone could help me.
I am trying to access my dedicated server's 127.0.0.1:99 through the public ip.
I do not want users to be able to access the localhost but I want only my script to access that ip.

is fsockopen() gonna help me? i am running apache on the same server where I am trying to access the localhost port.

thanks in advance

    yep.

    if you want to open a port, then you can access it via fsockopen. You will need to understand the protocols used by whatever listens to port 99 so that you can speak with it.

      i haven't tried the fsockopen() yet. I don't know the right syntax and the use.
      Would you please help me?

        if I do the following, what exactly happens? how to extend the connection to point to a
        file/link?

        <?php
        $fp = fsockopen("udp://127.0.0.1", 99, $errno, $errstr);
        if (!$fp) {
        echo "ERROR: $errno - $errstr<br />\n";
        } else {
        fwrite($fp, "\n");
        echo fread($fp, 26);
        fclose($fp);
        }
        ?>

          Well, the right syntax and examples of use can be found in the PHP Manual's entry on [man]fsockopen/man.

            Let me explain my problem:

            I have a dedicated server where I am running WMS(Windows Media Service) and for security reason, I have setup the WMS to listen to only a local port, say 127.0.0.1:99.
            I have apache running on the same machine. I want to verify the user first with mysql then
            connect to the WMS Publishing point. as the WMS listens to only the localhost, so I am
            dieing to design my system so that it makes a bridge in between the public ip and the localhost.

            Hope it makes sense.

              In order to do that, you'd need to know what protocol your WMS server uses, and have PHP speak that protocol.

              If it's HTTP, that's vaguely possible, but probably not straightforward. Depending on the protocol, it may not be possible with PHP via the web server.

              Mark

                MarkR wrote:

                In order to do that, you'd need to know what protocol your WMS server uses, and have PHP speak that protocol.

                If it's HTTP, that's vaguely possible, but probably not straightforward. Depending on the protocol, it may not be possible with PHP via the web server.

                Mark

                the WMS supports http mms and rtsp. i can bind the WMS to wither of those three.i just need to let the users accessing the ip and port.

                Thanks in advance

                  Try using a port > 1024 - Ports less than 1024 are reserved for system services (telnet, FTP, etc).

                  You would also require root on a linux server to bind to a port < 1024.

                    You can probably NOT do this. Your PHP script has no way to act as a gateway for these mms or rtsp protocols.

                    They'll have to connect directly to the server.

                    Mark

                      i tried this one, would it work if i modify a bit?

                      thanks

                      <?php
                      $domain = "127.0.0.1";
                      $ip = gethostbyname($domain);

                      $fp = fsockopen($ip, 8800, $err1, $err2, 5);
                      if(!$fp){
                      print "Unable to open";
                      }
                      if($fp){
                      fputs($fp, "GET /????? HTTP/1.0\r\nHost: $domain\r\n\r\n");
                      }
                      ?>

                      **the WMS is setup to listen to 127.0.0.1:8800

                        No, it would not work. You cannot do this because PHP cannot gateway this WMS protocol through HTTP. No - really!

                        Mark

                          is it php or WMS?
                          WMS supports mms, http , rtsp, udp.

                          DO you have any other idea which might help me solving the problem? I want to secure my
                          WMS publishing point on windows server standard edition.
                          I do have the enterprise too but no idea how to force the WMS to allow only authenticated users who are not on the same domain.

                          thanks for your help,Mark

                            Write a Reply...