CodeIgniter Forums

Full Version: Possible to accept $_POST data from non CI form? [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Aaron L.[/eluser]
Hello,

I am trying to integrate my CI application with my merchant account. In order to complete the transaction and update my customer's account (in CI) I need to post the result data from their API to my CI application.

So basically, I am trying to post standard $_POST data from outside of CI to my CI application where it is parsed and updates the user's account.

The api posts to a url formatted like this: http://domain.com/index.php/payments/updateaccount

is this possible?

- Aaron

El Forum

[eluser]coolfactor[/eluser]
Yes, in the normal way. $_POST is defined in your CI app. Or you can use $this->input->post();

El Forum

[eluser]Phil Sturgeon[/eluser]
Indeed, CI has no involvement with the way post works. It can come from anywhere and you can still use the $this->input->post(); function.

El Forum

[eluser]Aaron L.[/eluser]
Hi guys,

Thanks for your feedback. I am glad to hear that CI can do this. Here is my next issue then, I'm submitting a plain html form to test posting to my script (which will update the user's account).

Here is the url to the test form:
http://aaronlovelace.com/test.html

When you submit, it appears to send the data to the url it's coming from, not the CI application.

I get a 404 not found and the address bar shows:
Code:
http://aaronlovelace.com/post?amount=120&currency=usd&orderPage_timestamp=1184286540412&orderPage_version=4&orderPage_serialNumber=1842162628420176043016&merchantDefinedData1=60&merchantDefinedData2=3&billTo_customerID=23&merchantDefinedData4=english&currency=usd&decision=ACCEPT

Any ideas?

Aaron

El Forum

[eluser]coolfactor[/eluser]
You want your form to be posting using method="post". It appears you've using method="get" or not specifying the method in your <form> tag.

El Forum

[eluser]Aaron L.[/eluser]
Oh DUH!!!! I can't believe I overlooked that. Thanks for finding that for me. It looks like I was using action="post" instead of method="post".

El Forum

[eluser]ztinger[/eluser]
Big Grin