1 Reply Latest reply on Oct 12, 2011 8:06 AM by John Hawkinson

    http request for php page

    scriptworker Level 1

      I have this code to call a php page from Indesign:

       

      reply = "";
      conn = new Socket;

      if (conn.open ("www.terazo.be:80")) {
           conn.write ("GET /ipadres.php HTTP/1.0\n\n");
           // and read the server's reply
           reply = conn.read(999999);
           conn.close();
      }

       

      alert(reply);

       

      I get a 404 response (not found).

      But I am sure this file (ipadres.php) exists on the server.

      Any suggestions?

       

      Thanks,

      Michel

        • 1. Re: http request for php page
          John Hawkinson Level 5

          This is just like Roy Marshall's problem in http://forums.adobe.com/message/3964080#3964080.

          Your server requires HTTP/1.1 for the query, meaning you must specify the Host: header. See the example there; or on the command line:

           

           

          $ telnet www.terazo.be 80
          Trying 188.93.150.25...
          Connected to www.terazo.be.
          Escape character is '^]'.
          GET /ipadres.php HTTP/1.1
          Host: www.terazo.be
          
          HTTP/1.1 200 OK
          Date: Wed, 12 Oct 2011 15:04:09 GMT
          Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch
          X-Powered-By: PHP/5.2.6-1+lenny13
          Content-Length: 12
          Content-Type: text/html
          
          172.16.16.94Connection closed by foreign host.
          

           

          Note that the answer it gives is certainly not the  IPv4 address of your client on the global Internet.