String url=""; // I want this string to store the url .. ie "/x=" part...
But, you have abdicated all responsibility for dealing with what the client wants:
server.handleClient();
You can't have it both ways. Either you deal with what the client wants or you make handleClient() do what you want, possibly returning a pointer to char that points to the collected URL.