elmoi0010

check if url is active?

12 posts in this topic

Hi again guys, am here with a noob question e.e. 
How can i check if i get an active URL? because sometimes my internet is not working propperly and then i get the error saying, "YOU ARE NOT CONNECTED TO INTERNET" in internet explorer. and i want to check if there a way to test if the webpage is active. 
I was triying with _inetgetsource but dont seems to work.

 

$findtl = _GetIP
$check1 = _INetGetSource("https://www.happypanda.com")
If StringInStr($check1,$findtl) Then
   ConsoleWrite ("YES")
EndIf

 

Thanks in advanced.

Share this post


Link to post
Share on other sites



Maybe you can use_WinAPI_IsInternetConnected ?
 

 

You are right, maybe its working but i want to test the URL. Maybe the page is down. Its my question, thanks in advanced @jguinch <3

Share this post


Link to post
Share on other sites

Because the ternary operator is lovely and I like it  :P

1 person likes this

Share this post


Link to post
Share on other sites

Ping does not do the job anyway...

Msgbox(0,"", _UrlAlive("autoitscript.com/forum/topic/179385-check-if-url-is-active/"))

Func _UrlAlive($url)
    Return (Ping($url) = 0) ? 0 : 1
EndFunc

Well it does for the domain, but nothing else.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Right... I wrote this because in post #1 the OP seemingly wanted to check a domain, and ping is faster

Msgbox(0,"", _UrlAlive("happypanda.com"))

Func _UrlAlive($url)
    Return (Ping($url) = 0) ? 0 : 1
EndFunc

BTW strangely this code returns false  :mellow:

Msgbox(0,"", _UrlAlive("https://www.happypanda.com"))

Func _UrlAlive($url)
    Return Not (InetRead($url, 1) = "")
EndFunc

 

Share this post


Link to post
Share on other sites

That last part returns true for me...


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

I get for InetRead @error = 13  :huh:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now