PostURL HTTPS

1
0
-1

Is there a solution for the current PB limitation using PostURL that only allows for http and not https?

-Allen

Question Tags: 

Answers

Marco Meoni answered PostURL HTTPS

1
0
-1

Hi Allen,

here the code that you can run from Powerbuilder. Adapt according to the authorizations you must supply.

string ls_post_url, ls_post_variables, ls_status_text, ls_response_text
long ll_status_code
OleObject loo_xmlhttp
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.6.0")
ls_post_url='https://myHTTPSserver'
ls_post_variables='key=value'  // if you need
// send the POST
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
loo_xmlhttp.setRequestHeader( "Authorization", "put here your auth code if any" )
loo_xmlhttp.send(ls_post_variables)
//Get your response
ls_status_text = loo_xmlhttp.StatusText
ll_status_code =  loo_xmlhttp.Status
//Get the response we received from the web server
ls_response_text = loo_xmlhttp.ResponseText
loo_xmlhttp.DisconnectObject()

destroy loo_xmlhttp

If ll_status_code <> 201 Then
    MessageBox("HTTPS POST failed", ls_status_text)
End If

Cheers,

Marco