I have an automatic site, and I have a SAVE SEARCH function that saves the search that the user has done on the site for future use. What I do is that I store the entire URL in the database.
But I need to check it as a valid URL. It looks like this.
http://www.anywebsite.com/cars.php?postcode=CV2+5AS&distance=&make=&min_price=&max_price=&category_type=&body_type=&fuel=&colour=&transmission=&year_of_registration=&mileage=&engine=&doors=&seller=&keywords=&sort=PRICE_LOWEST&referer_url=http%253A%252F%252Flocalhost%252Fselling%252Fcars.php&trader_id=0&case=ADVANCE
Can anyone provide me with any idea on how I can achieve this?
I have a preg_match that is here.
if (!preg_match('/^https?:(\/\/)?(www\.)?([a-zA-Z0-9_%]*)\b\.[az]{2,4}(\.[az]{2})?/', $fields[$field_name]))
But it only checks URLs like http://www.anywebsite.com , while I need to check all the above URLs.
Any help would be greatly appreciated.
source share