I am busy implementing a third-party credit card payment API (paygate.co.za payXML) and the API submits an XML string to a URL that I specify, which I have set up to a route that calls a Controller function. I am not sure exactly how the API sends the XML string back, but it does not look like it is a normal POST.
Inside the controller function (which I have set up to catch the XML post) I have a set a up a test that writes "TEST" to a file. When I run the controller function manually by browsing the the route, then "TEST" gets written to the file. However, when I try to execute the controller function by initiating a curl_exec() to the route (submitting an XML string) nothing happens, the file remains blank so I am assuming that the controller function does not execute.
I have ensured that the URL I am submitting to via cURL is correct. I have also ensured that the route is not behind a firewall and is publically accessible without requiring authentication.
curl_error($oCurl); is empty and when I try print curl_exec($oCurl); the controller function [in which I execute the curl_exec()] never stops running.
Code extract from the controller function (which attempts to execute the other controller function by initiating a cURL connection to its route):
$url = "http://localhost:90/pmb/web/app_dev.php/payNotify";
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
$headers = array(
"Content-length: " . strlen($xml),
$oCurl = curl_init();
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($oCurl, CURLOPT_TIMEOUT, 120);
curl_setopt($oCurl, CURLOPT_POST, 1);
curl_setopt($oCurl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($oCurl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($oCurl);
Is there anything that I need to set up and in Symfony in order to accept a connection of this nature and route it to the required Controller function? Also, after I have succeeded in getting my Controller function to accept the connection? How would I access the incomming XML string?