I am trying to parse the HTTP request with the following code:
$request="GET /index.html HTTP/1.1";
$methods="GET|HEAD|TRACE|OPTIONS";
$pattern="/(^".$methods.")\s+(\S+)\s+(HTTP)/";
list($method,$uri,$http)=preg_split($pattern,$request);
print $method.$uri.$http;
Print does not return anything. I tried different modifications,but wasn't able to. I think the problem is with the regex. Any help is appreciated.