Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > POST or GET sample?

Forum

Search UsersRules
POST or GET sample?
#1
Active user
Points:: 0
Joined:: Feb 26, 2015

I have one URL. (Https://abc.com/zz.php)
I want to send a value to this address and get the result.

Is there an example of this?

Profile
#2
Just came
Points:: 0
Joined:: Jul 31, 2014

Hello Erdogan,

please try the following code:

Code
   ServerAddress = "abc.com";
   ResourceAddress = "/zz.php";
   Port = 443;
   Timeout = 10;
   
   // Sample value to send
   RequestBody = "id=10";
   
   SecureConnection = New OpenSSLSecureConnection(Undefined, Undefined);
   
   HTTPConnection = New HTTPConnection(ServerAddress, Port,,,, Timeout, SecureConnection);
   
   RequestHeaders = New Map();
   RequestHeaders["Content-Type"] = "application/x-www-form-urlencoded";
   
   Response = Undefined;
   
   HTTPRequest = New HTTPRequest(ResourceAddress, RequestHeaders);
   HTTPRequest.SetBodyFromString(RequestBody);
   
   Try
      Response = HTTPConnection.Post(HTTPRequest);
   Except;
      
      ErrMsg = "An error occured: " + ErrorInfo().Description;
      
      Message(ErrMsg);
      
   EndTry;
   
   // Result
   Body = Response.GetBodyAsString();

Profile
#3
Active user
Points:: 0
Joined:: Feb 26, 2015

You're great.
thank you so much.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.