multiple http POST in magento extension

I am creating a payment extension for magento and I have utiizar an API that uses 3 steps of communication. That is, I send an HTTP Post, receive information from the gateway, insert customer information, realize another HTTP POST, and finally, after generating the client choose the number of parcels and realize a final HTTP POST to confirm the transaction.

I've created my payment extension but how do the three HTTP post if the form of payment step allows me to submit one. Can not I create a single http post with all the details because of the above depending on the gateway.

To circumvent this, I'm doing the HTTP POST Js and running only the last HTTP POST in php extension. But this seems so insecure and very untraditional magento development, being an inappropriate solution.

Any better ideas?


You can use php cURL solution for the consecutive requests.

Magento has it's own curl adapter - Varien_Http_Adapter_Curl, if you would like to use it.

Here's an example of using it:

$curlAdapter = new Varien_Http_Adapter_Curl();
$curlAdapter->connect(your_host[, opt_port, opt_secure]);
$curlAdapter->write(Zend_Http_Client::POST, Zend_Uri_Http $url, [opt_http_ver, opt_headers, opt_body]);
$result = $curlAdapter->read();

opt_body are your post fields

Need Your Help

Android: how to check how much memory is remaining?


Below is my formula to check how much memory is remaining (not how much memory remains in the current heap, but how much more memory may be utilized before the application crashes). I'm not remotely

How to find/compare a class property in a List<class>

c# class list compare

I have a class like this which stores some data to later make a ListView:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.