Have a look at the WifiWebServer
example:
To know which webpage was requested you need to analyze the HTTP request header.
For example: GET /webpage.html?param=5 HTTP/1.1
would ask for webpage.html and the param is inside the url.
Parameter of the request could be read out similar if it was a POST request by the client from the HTTP body, in the same way (the http body is simply seperated from the header by an empty line).
Then you can set the arduino pins accordingly.