"get URL" as blocking command

jbv at souslelogo.com jbv at souslelogo.com
Mon Sep 8 13:41:42 EDT 2025


Hi list,

I have a LC script on a server that computes different
things, and also sends a request to an API to get some data.
More specifically, the script begins with some code that
outputs some result, then needs to send the API request
to get some data to run some more code.
The first part of the script is self-contained (it doesn't
need any extra data to run), while the second part of the
script can't run without the data from the API.
At the end, the results from both parts of the script are
combined into a json.

I am using "get URL" for the request and need to keep the
whole thing as fast as possible, despite the fact that the
API can take 1 to 3 seconds to return data.
I decided to have the first part of the script running
simultaneously with the API request, but since "get URL" is a
blocking command, I use a workaround as follows :

LC script :
    get URL "https://my-PHP-script"
/*
    first part of the code
*/
    -- read API data from DB
    -- perform second part of the code

my-PHP-script :
<?php
   echo "ok";
   // send request to API
   // write API data into DB

I have tested it and it works, but I was wondering if
there is some more elegant way to achieve the same thing...

Thank you in advance.
jbv


More information about the use-livecode mailing list