Send structured requests from PHP and handle model responses safely
You should be able to demonstrate the result described in the lesson and explain why each step was necessary.
Step-by-step
Define the request schema
Decide what your PHP application sends: model name, messages, temperature, and response format.
Create a server-side HTTP request
Call the LAN model endpoint from PHP rather than exposing the model endpoint directly to browser JavaScript.
Set timeouts
Local generation can take seconds or minutes. Use realistic connect and request timeouts and return a friendly error when the model is unavailable.
Validate the response
Treat model output as untrusted text. Validate JSON before using it and escape output before rendering HTML.
Measure latency
Log duration and model name so you can tell whether a code change or model change affected performance.
You should be able to demonstrate the result described in the lesson and explain why each step was necessary.
Troubleshooting
If a command or screen differs from the lesson, stop and verify the version you are using before forcing a change.
What you learned
You now understand the purpose of this part of the system and have a concrete result you can verify before continuing to the next lesson.