1 Reply Latest reply on Oct 10, 2011 6:21 PM by John Hawkinson

    Socket usage in JS CS5

    Roy Marshall Level 1



      I had this request in another post, but it is hidden under an inappropriate heading, so first let me apologised for the duplication. I will remove the other post.


      Anyway, I am wanting to open a http socket and post a message to a php page which logs my errors, and sends me emails.

      I can do this by using a JS -> Applescript -> shell script using the doScript method, but I need to eliminate the need for a Mac.


      I can use the socket method to successfully return data from an html page returned using a supplied API, so I know that receiving is possible, but maybe there is a restriction on sending an argument.


      Here is the code I am using, this is a live page on a live server, so if anything is successful,it will get posted, and I will receive emails! Not that I mind, just wanted to say.


      function combinedErrorReportWithSocket(errorText)   //errorText is something like "Library not found"


           myServerAddress = "automation.yappp.net:80";

           errorText = encodeURI(errorText);

           conn = new Socket();


           conn.write("GET /sendSrcError.php?e=" + errorText+"\ HTTP/1.0\n\n");

           reply = conn.read(999999);




      If this is not a correct way to go about this, can someone suggest an alternative? I do want to stay away from depending on Applescript though.


      Thanks in advance