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 Exchange에서 Scope 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