10 Replies Latest reply on Nov 12, 2014 5:16 AM by Ronald63

    Socket

    Ronald63 Level 4

      Hi,

       

      I use extendables library for checking if a token has expired and it works.

       

      #include 'extendables/extendables.jsx'
      
      var http = require('http');
      var url = 'http://foo.fr/mod_traffiq/getContributionModel.php?LOGIN=rhanot&CX_TOKEN=f7e240216f592fca71658caa560f910f&OP=FT'
      var response = http.get(url);
      $.write(response.body)
      
      //  response: 35;token connexion expired
      
      

       

      I want to use the Socket object but it does'nt work

      var reply = "";
      var conn = new Socket;
      
      if (conn.open ('foo.fr:80')) {
          var result = conn.write ('GET /mod_traffiq/getContributionModel.php?LOGIN=rhanot&CX_TOKEN=f7e240216f592fca71658caa560f910f&OP=FT HTTP/1.1\n\n');
          reply = conn.read(999999);
          var close = conn.close();
           $.write(reply)
      }
      
      // response: HTTP/1.1 400 Bad Request
      

       

      Thanks for your help

       

      Regards

      Ronald