I'm working on a project where I have to include a third party application in our system. This application transmitts parameters to a PHP file using jQuery ajax when calling the index.php. The exact function looks like this:
$.ajax( {
type : "POST",
cache : false,
crossDomain : false,
async : true,
url : "/somwhere/somefile.php",
data : "msg=37120&hello=true&USRID=1"
)};
I'm am not very experienced with AJAX at all but as far as I can see in the end the parameters "msg=37120&hello=true&USRID=1"
get postet on somefile.php. Now I want to post the variables directly onto somefile.php using PHP instead of JS/AJAX.
After some researches I found the following solution to send post data directly to the somefile.php
:
$url = "/somwhere/somefile.php";
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, "msg=37120&hello=true&USRID=1");
$response = curl_exec( $ch );
Unfortunately this is not working at all. No data arrives when I'm executing this code block. I've no idea what I'm doing wrong. Can someone tell me whats the mistake here? Or is there even a better way how to do this?