my urls in my site'll have international characters such as ş
, ğ
, ı
...
after reading lots of posts and blogs for url validation issue, I decided to support filter_var($url, FILTER_VALIDATE_URL)
with another pieces of codes since
- if url has int. characters, url can't validated
- http://www.d-mueller.de/blog/why-url-validation-with-filter_var-might-not-be-a-good-idea/ answered by bažmegakapa with +7.
then I concluded to use this idea at PHP validation/regex for URL
bažmegakapa offers to use
if (preg_match("#^https?://.+#", $link) and @fopen($link,"r")) echo "OK";
to see if link can be opened then it means it's validated.
After this point MY question:
Question - I loved this idea & it seems to me very brilliant. But after seeing that it has only +7 and that page has +>>7 answers, I want to ask that what is the idea of php masters who will be glad to answer this question to help like the ones like me; the rookies.
Is there any weaknesses in bažmegakapa's code? for example I don't know but can there be any url that fopen can't open it but actually it's a harmless, must-be-validated url? So what is the cure of the weaknesses you detected?
thank you
best regards