I have this code to validate whether a URL inputted is valid...
if(filter_var($param1, FILTER_VALIDATE_URL) === FALSE){
echo "invalidURL";
exit();
}
But when testing with this long-yet-valid url it says it's invalid...
Anyone have any ideas why? I can't find anything in FILTER_VALIDATE_URL that says it should consider a url of this length to be invalid, but simply by deleting characters it will eventually be deemed valid. Thanks for any thoughts!
Sorry all, just found this after a little more research...
"According to RFC 1034 , each part of domain name label cannot exceed 63 characters."
So it wasn't a valid URL after all - well done php!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.