Questions tagged [url-validation]

URL validation checks if a given text is a URL or not.

URL validation checks if a given text is a URL or not.

Such a check is often performed when a user has to enter a URL on a web form, to ensure that the entered text corresponds to a URL.

101 questions
132
votes
12 answers

How to check if URL is valid in Android

Is there a good way to avoid the "host is not resolved" error that crashes an app? Some sort of a way to try connecting to a host ( like a URL ) and see if it's even valid?
kidalex
  • 1,437
  • 2
  • 12
  • 14
129
votes
14 answers

C# How can I check if a URL exists/is valid?

I am making a simple program in visual c# 2005 that looks up a stock symbol on Yahoo! Finance, downloads the historical data, and then plots the price history for the specified ticker symbol. I know the exact URL that I need to acquire the data, and…
Daniel Waltrip
  • 2,530
  • 4
  • 25
  • 30
34
votes
12 answers

Dart / Flutter - Validating a string for URL

I'm trying to create a system in which I can validate a string to check if it's a url or not. (https://www.google.com/) I found the flutter package validator but this isn't dart 2 compatible, so won't be compatible with my code. Similarly named, I…
Jake
  • 1,906
  • 9
  • 32
  • 60
29
votes
8 answers

How to quickly check if URL server is available

I have a URL in the form http://www.mywebsite.com/util/conv?a=1&from=%s&to=%s And want to check if it is available. The links redirect me on a bad request page if I try to open these with a browser, however via code I can get the data that I…
AndreaF
  • 11,975
  • 27
  • 102
  • 168
22
votes
8 answers

How can I check if a URL exists with Django’s validators?

I want to check in django if a URL exists and if it does I want to show something on screen, i.e.: if URL_THAT_POINTS_TO_SOME_PDF exists SHOW_SOMETHING
Daniel Kivatinos
  • 24,088
  • 23
  • 61
  • 81
19
votes
2 answers

is URL valid or not

Possible Duplicate: what is the best way to check if a Url exists in PHP ?` I'm looking for a function that returns TRUE or FALSE in php, either the URL is valid or not. isValidURL($url); I think that simple... That would take into count all kind…
james
  • 413
  • 4
  • 7
  • 12
19
votes
5 answers

Validating URLs in Python

I've been trying to figure out what the best way to validate a URL is (specifically in Python) but haven't really been able to find an answer. It seems like there isn't one known way to validate a URL, and it depends on what URLs you think you may…
mp94
  • 1,209
  • 3
  • 11
  • 23
15
votes
1 answer

UrlValidator is not working for localhost

I'm facing an issue that i'm using UrlValidator in my code. UrlValidator urlValidator = UrlValidator.getInstance(); if(urlValidator.isValid(url)) { throw new IllegalArgumentException( url + "not valid"); } where url i'm passing is…
Little bird
  • 1,106
  • 7
  • 28
  • 58
11
votes
7 answers

Why UrlValidator do not work for some of my Urls?

String[] schemes = {"http","https"}; UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_ALL_SCHEMES); System.out.println(urlValidator.isValid(myUrl)); the following URL says, invalid. Any one know why is that. the localnet is…
dinesh707
  • 12,106
  • 22
  • 84
  • 134
9
votes
1 answer

django URLValidator produced bogus errors

I'm using the Django URLValidator in the following way in a form: def clean_url(self): validate = URLValidator(verify_exists=True) url = self.cleaned_data.get('url') try: logger.info(url) validate(url) except…
KVISH
  • 12,923
  • 17
  • 86
  • 162
6
votes
3 answers

prevent xss attack via url( PHP)

I am trying to avoid XSS attack via url url :http://example.com/onlineArcNew/html/terms_conditions_1.php/%22ns=%22alert%280x0000DC%29 I have…
Rajeev Ranjan
  • 4,152
  • 3
  • 28
  • 41
5
votes
2 answers

Yii Framework: Specifying defaultScheme in URL Validator

I'm sure this is straightforward, but I can't figure it out. I'm trying to set a defaultScheme to the Yii URL validator in my model, so that it accepts addresses like www.something.com as well as http://www.something.com. To do this, I'm using the…
Donnie Thomas
  • 3,888
  • 8
  • 47
  • 70
5
votes
1 answer

how can I validate URL(domain) allowing wildcard(*, %) in java

I want to check validate URL allowing wildcard in java. I found some nice examples about validating URL in java (REGEX, urlValidator), but those aren't providing the wildcard character. Here's what I'm practicing: CODE(urlValidator) public void…
qumm
  • 137
  • 1
  • 13
5
votes
2 answers

(rails) validating URL help with regexp

i'm using the following to verify if a URL is formatted validly: validates_format_of :website, :with => URI::regexp(%w(http https)) however, it doesn't work when the url doesn't start with http:// or https://. Is there some similar way to validate…
Tony Stark
  • 24,588
  • 41
  • 96
  • 113
5
votes
2 answers

URL validation works fine but keep connection and restrict any further requests

public class UrlVarificationTask extends AsyncTask { private String url; private UrlVarificationDelegate delegate; private HttpURLConnection huc; public UrlVarificationTask(String url, UrlVarificationDelegate…
Mohd Mufiz
  • 2,236
  • 17
  • 28
1
2 3 4 5 6 7