2

I'm trying to POST from one controller method to another with the Http class.

$http = new Http();
$url = Uri::base().'index.php?option=com_mycontroller&task=my_method';
$response = $http->post($url, []);
die($response->getBody());

But it just returns a redirect to the login page.

How can I post to this method with authentication?

3
  • Please take our tour. Commented Mar 14, 2022 at 23:37
  • Is there a reason you need an internal process to go via the internet? Commented Mar 16, 2022 at 22:03
  • @jamesgarrett it was for a payment gateway that needed to collect post data then post it to another url. I did it with redirecting back to the page and using JS to submit a hidden form in the end
    – justrusty
    Commented Apr 8, 2022 at 12:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.