1 Reply Latest reply on Apr 7, 2015 3:51 PM by man9ar00

    How can I send data using HttpConnection?

    kimDino8

      1.

      follow my instruction please.

      (1) connect my website http://selfimg.com/secret/ (click)

      (2) input textfields "1234" and "ABCD" and press 'Submit' Button

       

      You will get 'BCGCA'. is that right?

       

       

      2.

      I want make this in Illustrator.

      but I can't send "1234" and "ABCD" to website(http://selfimg.com/secret/process.php)

       

      All I want is,

      (1) Send "1234" and "ABCD" to http://selfimg.com/secret/process.php

      (2) Get Decoded string "BCGCA"

       

       

       

      please read my source code.

       

      And talk to me what i missed.

       

       

       

       

       

      ////////////////////////////////////////////////////////////////////////////////////////// //////////////////

       

      var libPath = "C:/Program Files/Adobe/Adobe Bridge CS3"

      if( webaccesslib == undefined ) {

      if( Folder.fs == "Windows" ) {

        var pathToLib = libPath + "/webaccesslib.dll";

      } else {

        var pathToLib = libPath + "/webaccesslib.bundle";

        // verify that the path is valid

      }

      var libfile = new File( pathToLib );

      var webaccesslib = new ExternalObject("lib:" + pathToLib );

      }

       

       

      //posting a string

      var http = new HttpConnection("http://selfimg.com/secret/process.php" ) ;

      http.request = "pass=1234" ;

      http.request = "code=ABCD" ;

      http.method = "POST"

      http.execute() ;

       

       

      ////////////////////////////////////////////////////////////////////////////////////////// //////////////////

       

       

      Thank you. and Happy new year.

        • 1. Re: How can I send data using HttpConnection?
          man9ar00 Level 1

          I'm working on getting HTTP calls to work myself, though between Bridge and Illustrator, and synchronously. But...

           

          I would think your request parameters should be:

           

          http.request = "pass=1234&code=ABCD" ;

           

          or

           

          http.request = "pass=1234" ;

          http.request += "code=ABCD" ;

           

          doing it as you've written, you overwrite pass=1234 with code=ABCD

           

          and you also probably want to process the response

           

          var response = http.response; //after the execute