Jump to content

check if url exist function?


Recommended Posts

I have tried it I didnt really saw a big differents

so i used the ping method but still stook me a very long time

especially when the url wasnt found or loading it can take up to 10 sec until it is done  thats insane, there has to be a way to not skip the url when it takes longer than 1 sec

and it cant be the problem of my internet connection becasue If have 120mb internet speed.

Edited by Arclite86
Link to comment
Share on other sites

I dont think i am looking for a timeout because this is my code right now

Local $iPing = Ping($websiteread, 1000)

    If $iPing Then ; If a value greater than 0 was returned then display the following message.
       ConsoleWrite("exist! The roundtrip-time took: " & $iPing & "ms." & @CR)

    Else
         ConsoleWrite ($websiteread & " not Exists" & @CR)

so the time out is already set to 1000 if am right

 

this part:

If $iPing Then ; If a value greater than 0 was returned then display the following message.
       ConsoleWrite("exist! The roundtrip-time took: " & $iPing & "ms." & @CR)

works perfect 9/10 it detects the website in less than 20 milie seconds, how it should be

but when this part happens

Else
         ConsoleWrite ($websiteread & " not Exists" & @CR)

it can take up to 10 sec when my 

Local $iPing = Ping($websiteread, 1000)

is only 1 sec

this problebly is caused by loading the page and 9/10 it fails

so if there is a way to not load it longer than 1sec the problems wil al be solved

 

i have no experience with API and WINHTTP or HEAD HTTP  so could you please help me with the script

Link to comment
Share on other sites

I am also trying to create an other method because there are allot of website that sometimes are the same so i came up to an idea when the url has passed the test it adds it to a list and every time before it does the ping method it first checks if its in the list of not than contineu to the ping method anyway, i am trying to creat this script but I need some help:

$list1count = _GUICtrlListBox_GetCount($List1)
                        $list1count4 = _GUICtrlListBox_GetCount($List4)
For $idx=1 To $list1count


;my code bellow
Local $i7 = 0

Do

Local $asplit2 = $websiteurls
iF $asplit2 Then
 _GUICtrlListBox_AddString($List2, GUICtrlRead($list1))
  $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)
                       If $iIndex4 = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)
            $lees4 = _GUICtrlListBox_GetCount($list2)
GUICtrlSetData($Input2,$lees4)
ContinueLoop
Else

    ConsoleWrite("nietgevonden")
EndIf
Until $i7 = $list1count4


;original code


            Local $iPing = Ping($websiteread, 1000)

    If $iPing Then ; If a value greater than 0 was returned then display the following message.
       ConsoleWrite("exist! The roundtrip-time took: " & $iPing & "ms." & @CR)
       _GUICtrlListBox_AddString($List4, $asplit2)
       _GUICtrlListBox_AddString($List2, GUICtrlRead($list1))
        $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)
            $lees4 = _GUICtrlListBox_GetCount($list2)
GUICtrlSetData($Input2,$lees4)

    Else
         ConsoleWrite ($websiteread & " not Exists" & @CR)
        $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)
            $lees4 = _GUICtrlListBox_GetCount($list2)
GUICtrlSetData($Input2,$lees4)

    EndIf

    Next

 

Link to comment
Share on other sites

Arclite,

When i run it i have 1 to 2 second delay between web sites that are not found.  If you are experiencing a delay with the code that i posted then rhe delay is elsewhere.

I would strongly suggest that you pursue the direction that trancexx advised.

Just curious, what are you trying to do?

Kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...