Nested file_get_contents / json_decode
It seems to me that you are making multiple requests to 'https://localhost/answers'.$k['id'] inside a loop and that you have one route for each answers, such as:

https://localhost/answers100
https://localhost/answers101
https://localhost/answers102


My suggestion is to abandon that approach and combine them into one route that can handle multiple ids.
For instance:

https://localhost/answers?id[]=100&amp;id[]=101&amp;id[]=102


Then grab the id like this:

$ids = $_GET['id'];


which is an array.
Process each id one by one and combine the result and send as JSON.
For instance:

{
    "100": {
        "summary": "",
        "solution": ""
    },
    "101": {
        "summary": "",
        "solution": ""
    },
    "102": {
        "summary": "",
        "solution": ""
    }
}


So, instead of making 400 requests, you only need to make 1 request.
Much faster.