Hello,
I'd like to know if a url is valid or not.
For example :
- http://www.fkhzfziufhzoij.com is not valid
- http://www.mathworks.fr is valid
Do you think it's possible ? thank you

 採用された回答

Geoff Hayes
Geoff Hayes 2014 年 7 月 28 日

0 投票

The documentation for urlread indicates that you could use the status output variable to indicate if the operation is successful or not.
For your two examples,
[str,status] = urlread('http://www.fkhzfziufhzoij.com');
returns an empty str and status==0.
Whereas,
[str,status] = urlread('http://www.mathworks.fr');
returns the HTML for the page in str and status==1.

3 件のコメント

Charly
Charly 2014 年 7 月 29 日
Is there a reason why your examples don't give the same results on my computer ? I get status==0 for both cases...
Geoff Hayes
Geoff Hayes 2014 年 7 月 29 日
Are you copying the lines of code exactly as above? What does str return for each? If you paste just the URL into your internet browser, what happens?
Image Analyst
Image Analyst 2014 年 7 月 29 日
I get the same results as Geoff. Can you see anything in your web browser? Maybe it's some firewall issue???

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeScope Variables and Generate Names についてさらに検索

タグ

質問済み:

2014 年 7 月 28 日

コメント済み:

2014 年 7 月 29 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by