Post to External Site URL

Post to External Site URL

  
I know there is a way to go to an external site and use a dynamic URL to pass parameters as part of the URL request line.

Is there a way to navigate to an external site and POST the parameter request? The external site I need to redirect to does not accept the parameters via the GET method.

Thanks

Ken
Hi Ken,

I believe the Extension HTTPRequestHandler allows you to make a post request.

Cheers,
Tiago Simões
Hi Tiago & Everyone!
 
I have this requirement to implement HPP (Hosted Payment Pages).
The user need to be redirect to External site passing some values by POST.
 
The extension above provide methods to use in server. I tried create external URL and a linked button with On Click method 'Submit' but the browser generates always a GET request.
 
I'm using v8.0.1 both SS and SC.
 
Any ideas before moving to hardcoded solution?

More info: http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET
 
Thanks

André Alho wrote:

Hi Tiago & Everyone!
 
I have this requirement to implement HPP (Hosted Payment Pages).
The user need to be redirect to External site passing some values by POST.
 
The extension above provide methods to use in server. I tried create external URL and a linked button with On Click method 'Submit' but the browser generates always a GET request.
 
I'm using v8.0.1 both SS and SC.
 
Any ideas before moving to hardcoded solution?

More info: http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET
 
Thanks

Hi André,

I am trying to do the same thing? Did you figure out how to do it?


Hi,


Yes, I made an extension for this. Right now I'm not able to get it because it's on client's infrastructure.


But I'll get it and share here. Just need to wait for my co-workers to get back from vacations.


Gurvinder Singh wrote:

André Alho wrote:

Hi Tiago & Everyone!
 
I have this requirement to implement HPP (Hosted Payment Pages).
The user need to be redirect to External site passing some values by POST.
 
The extension above provide methods to use in server. I tried create external URL and a linked button with On Click method 'Submit' but the browser generates always a GET request.
 
I'm using v8.0.1 both SS and SC.
 
Any ideas before moving to hardcoded solution?

More info: http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET
 
Thanks

Hi André,

I am trying to do the same thing? Did you figure out how to do it?




Would a javascript post work?

Something like this

SyntaxEditor Code Snippet

function post(path, params, method) {
    method = method || "post"; // Set method to post by default if not specified.

    // The rest of this code assumes you are not using a library.
    // It can be made less wordy if you use one.
    var form = document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", path);

    for(var key in params) {
        if(params.hasOwnProperty(key)) {
            var hiddenField = document.createElement("input");
            hiddenField.setAttribute("type", "hidden");
            hiddenField.setAttribute("name", key);
            hiddenField.setAttribute("value", params[key]);

            form.appendChild(hiddenField);
         }
    }

    document.body.appendChild(form);
    form.submit();
}

and then on the extended properties - onclick event of the button:

"post('/path to page /page.aspx', {param1: 'value1'});return false;"



André Alho wrote:

Hi,


Yes, I made an extension for this. Right now I'm not able to get it because it's on client's infrastructure.


But I'll get it and share here. Just need to wait for my co-workers to get back from vacations.


Gurvinder Singh wrote:

André Alho wrote:

Hi Tiago & Everyone!
 
I have this requirement to implement HPP (Hosted Payment Pages).
The user need to be redirect to External site passing some values by POST.
 
The extension above provide methods to use in server. I tried create external URL and a linked button with On Click method 'Submit' but the browser generates always a GET request.
 
I'm using v8.0.1 both SS and SC.
 
Any ideas before moving to hardcoded solution?

More info: http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET
 
Thanks

Hi André,

I am trying to do the same thing? Did you figure out how to do it?





Thanks! Can you please post it as soon as possible?

Good news!

I've published a new component to handle this.

Check it out Post & Request

André Alho wrote:

Good news!

I've published a new component to handle this.

Check it out Post & Request


Hey André,

I am using the java environment so I am unable to publish this extension. Do you know any workaround for that?

Gurvinder Singh wrote:

André Alho wrote:

Good news!

I've published a new component to handle this.

Check it out Post & Request


Hey André,

I am using the java environment so I am unable to publish this extension. Do you know any workaround for that?

You always have the option to convert .NET code to Java. Isn't done yet...

You can also try with javascript, but since OS always renders the page within a form and you can't have nested forms, you need to add a jsp to resources to handle the redirect with post.

Something like:

<script>
function redirect(val1, val2) {
document.myForm.val1.value = val1;
document.myForm.val2.value = val2;
document.myForm.submit();
}
</script>

<form name='myForm' id='myForm' action="myPage.jsp" method="post">
<Input id='val1' name='val1' type='hidden'/>
<Input id='val2' name='val2' type='hidden'/>
</form>


André Alho wrote:

Gurvinder Singh wrote:

André Alho wrote:

Good news!

I've published a new component to handle this.

Check it out Post & Request


Hey André,

I am using the java environment so I am unable to publish this extension. Do you know any workaround for that?

You always have the option to convert .NET code to Java. Isn't done yet...

You can also try with javascript, but since OS always renders the page within a form and you can't have nested forms, you need to add a jsp to resources to handle the redirect with post.

Something like:

<script>
function redirect(val1, val2) {
document.myForm.val1.value = val1;
document.myForm.val2.value = val2;
document.myForm.submit();
}
</script>

<form name='myForm' id='myForm' action="myPage.jsp" method="post">
<Input id='val1' name='val1' type='hidden'/>
<Input id='val2' name='val2' type='hidden'/>
</form>


Or follow Rui Barbosa's advice...