i am writing an api with php, and i just simply need to know how to do this
i also am unsure how to format a GET request, and here's an example of the kind i want to make:
api.php?a=04&v=00
(action 04 just simply means retrieve entry counts as an integer, and value 00 means send the integer back upon connection and query)
also
api.php?a=03&v=00&e=XX
(action 03 means send back XX entries in ascending order with a value of 00 which just means send it back with each piece of information ending with a \t)
(for example, if entry foo was #0 in the database, and its bar was 1 and bat was 2, then it would say
foo\t 0\t bar\t 1\t bat\t 2\t\n
)
a sloppy pseudocode here can represent what im thinking:
//cf means "cannon fodder"
//pingback will be a GET request to /api.php?a=04 which asks the database for entry count,
//making a network request that many times
//the NetworkRequest function will send a GET request to /api.php?a=03 in order to return a list of data, and the actual entry to return is specified for each for looping of $cf
for($cf = 0; $cf < $pingback; $cf++) {
function NetworkRequest()
{
TCPobject.connect("api.php?a=03&v=00&e=" $cf);
//i dont know what code i could use to read the response and then process it with regex to separate out data spaced by \t characters
//i could try to format my data as json instead
}
NetworkRequest($cf);
}
i have a feeling json parsing would be a better alternative to my above example of how code was formatted