So I’m trying to figure out how to create an api to act as a go between some management software and a credit card processor. The situation is I click checkout on a shopping cart. This uses a link I provide to the api I’m developing. I need the API to get the info from the shopping cart then format it to send to the credit card processor to handle the payment.
The problem I’ve been having is getting that info from the cart. It either comes up without the info or the page doesn’t load. As in I click the checkout button and the page doesn’t change.
I this got something from file_get_contents('php://input');
before but I don’t remember what it was exactly.
Using something like this is giving me problems.
$jsonPOST = file_get_contents('php://input');
$jsonArray = json_decode($jsonPOST, true);
print_r($jsonArray,false);
Testing it initially worked but now it doesn’t. Trying a raw dump ends up with an empty string.
var_dump( file_get_contents('php://input'));
Also, I’m working in a subfolder instead of the root directory. So the url would be www.url.com/api
. I’ve got an htaccess file that contains this:
RewriteEngine On
RewriteRule . index.php