Made 2 small changes to the code below ("echo" instead of "return" and added "exit(); to the bottom of the script") and now the code works as expected. This was using a jQuery.get. I will now test using cURL but I expect things will work the same.
Thank you to those who responded. It got me headed in the right direction.
I have been away from this for a few days but I'm back at it.
I have created a little component and set up a small test. The code for the component is:
<?php use Joomla\CMS\Log\Log; defined('_JEXEC') or die; JLog::addLogger( array('text_file' => 'reverse_log.php'), JLog::INFO, array('reverse')); JLog::add('You have reached com_reverse', JLog::INFO, 'reverse'); $app = JFactory::getApplication(); $in = $app->input; $text_str = ""; $text_str = $in->getString('text_str', 'gnirts oN'); JLog::add('Text string is: ' . $text_str, JLog::INFO, 'reverse'); echo "Remote: " . strrev($text_str); exit();
As you can see, I am retrieving a string, reversing it and returning it. In addition, I am logging a couple of messages.
This partially works. I get to my component and I log the messages. However, instead of the reversed string, I get the web page returned (the HTML of the home page of the Joomla site). Is there some way of suppressing this and getting the reversed string?
What seems a simple thing is proving quite puzzling to me and I need a few hints. The scenario is site A will from time to time send some data to site J (a Joomla environment) to process. Site J has no inclination that site A will do this. Site J does not initiate the exchange, site A does. This is strictly server to server. There is no human interface.