Friends, I immediately ask you not to judge strictly, I'm just learning.

The front is a clear task:

1) There is a script that sends a GET request to my server. In response to this request, I have to return an array of strings in the following format:

line number; Username; password; 0x0A - this is the end of each line, as I understand it?

The question is how to do this? I tried this:

echo "1;D;".date("dmY H:i:s")."\n"; echo "2;C;".$data_card['code'].";0; ;".mb_substr($data_card['owner'], 0, 16, "UTF-8").";0;01.12.2300\n"; echo "3;L;1;26.10.2016;30.10.2016;777;".$data_card['dt'].";5.00;26.10.2016 09:01:23\n"; echo "4;t;1\n"; echo "5;e;2\n"; echo "6;#"; 

but as I understood it, I displayed pure strings on the screen and did not return an array of strings, right? I have a task to return an array of strings so that the script would process it. how the script is implemented and what's inside is not clear, this information is not available

  • well, first you need to analyze how and where GET comes from. What headlines does the answer require? What type of response (Content-Type: plain / text)? those. you need to add all this before the conclusion, and then everything is correct. the output will go back, not the screen - DiGiTAL
  • To be more precise: The hardware controller sends the Get data requests. this is why we cannot see how the script itself is implemented, there is no documentation. purely said that a request of such a plan is being sent: domain.com/index.php?r=terminals/… - we must return an array of strings for such a get request. data in each line must be separated by ";" The string itself must end with the character 0x0A - as I understand it \ n? - WhoIsDT
  • and these are all the ekhi you have in index.php? Have you tried in the browser to see what your script displays on such a request? and yes, 0x0A is \ n, everything is correct (in the browser is ignored, so you will have everything in the answer in one line), and to the last line also \ n stick to it - DiGiTAL

0