Close a Blank Application with a RETURN value

I have a Blank App which is called by an external 3rd party application. Upon completion I would like to RETURN to the 3rd party application a RETURN VALUE.
I am closing the Blank app with the below. Can someone please tell me how I can include a value for the 3rd party application to pickup.

echo “<script>window.close();</script>”;

The basic logic is like this.

  1. Third party makes a http request to your application, like the same way a user query an API
  2. Your blank application should response with a valid format, lets say a json or html content.
  3. Third party read the response.

Let me show and scenario.

You have a website site called stats.com that display stats from another website of your domain called hello.com. Into hello.com there is a blank application that summarize the total of users of your site, so, your blank application could looks like this:


sc_lookup(dataset, "select count(*)  from users" );
$total = {dataset[0][0]};

// The step 2 is happening here
header('Content-Type: application/json');
echo json_encode(['total_users' => $total], JSON_PRETTY_PRINT);

When you open the blank application via web browser you will look this:


{
    "total_users" => 45
}

How does stats.example.com read that content? If the third party is using PHP then you can do:


// The step 1 is happening here
$content = file_get_contents('http://hello.com');

// The step 3 is happening here
$stats = json_decode($content);
echo "There are {$stats->total_users} users online";

Take a look where evey step is triggered. This is a very basic example using a json format, but can use html, xml, plain text, or whatever. Also, your third party in some cases can use PHP, javascript, or any language that supports the format returned

Thank you so much