elmoi0010 Posted December 18, 2015 Posted December 18, 2015 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.
jguinch Posted December 18, 2015 Posted December 18, 2015 Maybe you can use_WinAPI_IsInternetConnected ? elmoi0010 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
elmoi0010 Posted December 18, 2015 Author Posted December 18, 2015 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
JohnOne Posted December 19, 2015 Posted December 19, 2015 (edited) Func _UrlAlive($url) Return Not (InetRead($url, 1) = "") EndFunc Edited December 20, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jguinch Posted December 20, 2015 Posted December 20, 2015 J1, you should add the $INET_FORCERELOAD parameter, no ? JohnOne 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
mikell Posted December 20, 2015 Posted December 20, 2015 ?Msgbox(0,"", _UrlAlive("autoitscript.com")) Func _UrlAlive($url) Return (Ping($url) = 0) ? 0 : 1 EndFunc
jguinch Posted December 20, 2015 Posted December 20, 2015 (edited) @mikell : why not Return (Ping($url) <> 0) ? Edited December 20, 2015 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
mikell Posted December 20, 2015 Posted December 20, 2015 Because the ternary operator is lovely and I like it kylomas 1
JohnOne Posted December 20, 2015 Posted December 20, 2015 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 EndFuncWell 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.
mikell Posted December 20, 2015 Posted December 20, 2015 Right... I wrote this because in post #1 the OP seemingly wanted to check a domain, and ping is fasterMsgbox(0,"", _UrlAlive("happypanda.com")) Func _UrlAlive($url) Return (Ping($url) = 0) ? 0 : 1 EndFuncBTW strangely this code returns false Msgbox(0,"", _UrlAlive("https://www.happypanda.com")) Func _UrlAlive($url) Return Not (InetRead($url, 1) = "") EndFunc
SadBunny Posted December 20, 2015 Posted December 20, 2015 That last part returns true for me... Roses are FF0000, violets are 0000FF... All my base are belong to you.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now