1

There is a form and i am getting $_POST data. The code is this

   if (isset($_POST) && $_POST) {
        $fields = $_POST;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://example.org/index.php/public/example/SaveExample");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
        $output = curl_exec($ch);
    }   

But the call to controller is not working.what will be the issue.anybody pls help

jaina
  • 43
  • 1
  • 8
  • anybody pls help.i am new to this. – jaina Jun 23 '20 at 16:30
  • Where do you want to send the data and what is the error you're facing? Please clarify. – sauhardnc Jun 23 '20 at 18:40
  • i want to pass the posted data to controller.i am using curl for it.saveExample is my function in controller.now that call is not working.that function is not calling.when submitting form.only a refresh is happening.values are not entering to database. – jaina Jun 24 '20 at 02:54
  • Ok, but why CURL? This operation can be performed easily without it. – sauhardnc Jun 24 '20 at 03:11
  • see, when to use curl - https://stackoverflow.com/questions/3062324/what-is-curl-in-php – sauhardnc Jun 24 '20 at 03:11

0 Answers0