d22552000 Posted September 8, 2007 Share Posted September 8, 2007 Is it possible to take input and seperate it on every certain character or regular expression? then split whats before to one string and whats after to another string? I am making a webserver and I need to seperate the first line of a browser request: "GET / HTTP/1.1" is an example call for root on the webserver "GET /file/index.html HTTP/1.1" is a call for index in file directory. I have seen people do it to seperate a string url: $url = "http://domain.com/file" turns into $url1 = "http://" $url2 = "domain.com" $url3 = "/file" but I wonder how they did it... can you please help me? I posted the topic earlier (12h ago) but it got buried. Link to comment https://forums.phpfreaks.com/topic/68512-solved-strign-seperator-on/ Share on other sites More sharing options...
d22552000 Posted September 8, 2007 Author Share Posted September 8, 2007 would this work!!!?? $request = split("[\n\r\t ]+", $s); if ($request[2]=="/") { echo "You requested HOME"; } elseif $request[2]=="/*") { echo "You requested a file or directory: ".$request[2]; } else { echo "Your request was invalid"; } Link to comment https://forums.phpfreaks.com/topic/68512-solved-strign-seperator-on/#findComment-344373 Share on other sites More sharing options...
AndyB Posted September 8, 2007 Share Posted September 8, 2007 I posted the topic earlier (12h ago) but it got buried. Then 'bump' it instead of opening another thread on the same topic. http://ca.php.net/manual/en/function.parse-url.php is probably what you're looking for Link to comment https://forums.phpfreaks.com/topic/68512-solved-strign-seperator-on/#findComment-344380 Share on other sites More sharing options...
d22552000 Posted September 8, 2007 Author Share Posted September 8, 2007 pelase check fopen error for my recent problem. Link to comment https://forums.phpfreaks.com/topic/68512-solved-strign-seperator-on/#findComment-344389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.