Skip to main content
Known Participant
January 3, 2014
Question

How can I send data using HttpConnection?

  • January 3, 2014
  • 1 reply
  • 924 views

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.

This topic has been closed for replies.

1 reply

Inspiring
April 7, 2015

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