Is it ok to have brackets or parenthesis in URL?
Parentheses “()” may be used as such in the query part of URL (i.e., the part after “?”). It is allowable, but not necessary, to %-encode them, as “%28” and “%29”.
Brackets “[]” shall be %-encoded, as “%5B” and “%5D”, in the query part.
The sample URL, which is a real URL as www.website.com actually exists (please use www.example.com as a dummy domain name, it is guaranteed to not exist), is thus correctly formed.
The general rules for URL syntax are defined in Internet-standard STD 66, which is currently RFC 3986. Its Appendix A specifies the rules for characters, listing parentheses as belonging to the “sub-delims” group which is allowed without %-encoding in the query part but the brackets as belonging to “gen-delims” which shall be %-encoded.
Oh, it is "fine" (as Kinected also asked: what is fine?) for parenthesis but perhaps not for square brackets. But if you are afraid, always use urlencode
for query strings.
<?php
echo "http://www.example.com/index.php?boo=",urlencode("sample(parenthesis)and[square_brackets]");
//http://www.example.com/index.php?boo=sample%28parenthesis%29and%5Bsquare_brackets%5D
Demo: http://codepad.org/ZKaROUr7