Valid Url Format Checking Inwards Codeigniter 2.X Using Custom/Extended Bird Valdiation Library
CodeIgniter lacks amongst URL validation. The solely i that it provides is called prep_url which does cypher to a greater extent than thence prepend "http://" to URLs if missing. Create a file inward the application/library directory called MY_Form_validation.php. Make the cast refer MY_Form_validation every bit well. Be certain that it extends CI_Form_validation, as well as that it calls the nurture constructor. This volition permit y'all to extend the built-in validation library as well as add together additional validators to it. Then inward your code, y'all tin merely add together additional validators like: $rules['URL'] = 'required|prep_url|valid_url_format|url_exists'; The ii novel validators are valid_url_format which checks for a properly formatted URL as well as url_exists which checks for a valid server. You should prefix the ii amongst prep_url thence that if they don’t larn into a system the other validators won’t fail. if (!d...