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. Mar 14, 2022 at 23:37
  • Is there a reason you need an internal process to go via the internet? 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
    Apr 8, 2022 at 12:16

0

Your Answer

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

Browse other questions tagged or ask your own question.