• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to check URL validity

563/5000
good evening.
In post n. I explained the reason for which I have shown different results than real ones.
I thought that with a macro it could be done at the same time the overspending and arrangement of an url.
In post n. 10 I explained that I would be fine to modify the "url1" file applicable to a list of urls in the same column. I made another way to add the protocol to the urls that do not have it and transform (with excel formulas) the second level redirected urls (like line 14) into the top tier url.
Thank you
 
Hi stefanoste78, one thing to add which is: If you don't get any effective solution from Sir Chihiro or Marc L, I doubt you will have any from anywhere. These two are the legends on automation when it comes to work within vba.
 
There is a difference between being good and having intuition.
I do not doubt the excitement of others. I just asked for a small change to an existing code. I do not think it's so difficult for anyone who knows the macro language ...
 
Well said. Then you should think off those who like to pilfer other's code and manipulate that. A purist coder doesn't imitate other's code rather he makes that himself anew. I didn't tell you anything out of hypothesis. It's fact. Anyways, you didn't get your question answered yet only because you were not explicit enough about what you really wanted in the first place. Thanks.
 
Well said. Then you should think off those who like to pilfer other's code and manipulate that. A purist coder doesn't imitate other's code rather he makes that himself anew. I didn't tell you anything out of hypothesis. It's fact. Anyways, you didn't get your question answered yet only because you were not explicit enough about what you really wanted in the first place. Thanks.
Hi ,

The use of the word pilfer is unwarranted ; anything that is in the public domain is meant to be used by others , as long as credit is given to the original author. Pilferage is when something created by another person is taken and passed off as one's own.

No programmer worth his salt reinvents the wheel.

Anyone who says he does that is merely showcasing his inefficiency.

All good programmers like to see how others have done it , which is why you see so much of good code on the Internet , which is why there is so much of collaboration in software.

There is absolutely nothing wrong in taking good code , where ever it comes from , and seeing how it can serve your ends , or seeing how it can be bettered or modified to do something else , which the original coder might not have thought of.

Narayan
 
I just asked for a small change to an existing code. I do not think it's so difficult for anyone who knows the macro language ...
Where is the code in your initial post ?‼ :confused:
You just asked for some code to bring same result as your attachment
which since post #2 I answered it is difficult to code that
as your result does not match your explanation neither the Logic !

As an attachment needs A C C U R A C Y !

I do not know macro language 'cause it was replaced by VBA
since around 20 years !

So without any crystal clear explanation how you could have the result
of row #14 of your attachment, as I do not know how to produce
such wrong result without any logic using a fast request way
- even if Ross' code could produce some wrong results
but not mine using same request -
the only way without any logic to have same wrong result as yours
is to go with the slowest way by piloting Internet Explorer …
But even using this way I can't obtain same exact "redirection"
of row #14 so we wonder how you could ?‼
By intuition ? So it can't be coded ‼

As reminders you never answered :

• post #2 :
Also check exact result with the one of this row #14 …

• post #7:
As I do not know how to produce wrong result
so first check row #14 result as it can't be a redirection

• post #9:
And for row #14 ?! …
'cause a request code can't return same result as yours

• post #11 :
As on my side row #14 can not be a redirection whatever the tool used
so I can't reproduce same wrong result …

post #20 :
Last chance : check your result for row #14 !
(Direct link on post #15)
Like we do not have same result as yours as it is very difficult
to get a redirection result when no redirection exists

post #23 :
Read post #13, so try and write back what is exactly your result !


As it is very not a protocol problem :rolleyes: but just respecting logic …
No accurate sample result, no code !

______________________________________________________
If you can’t explain it simply, you don’t understand it well enough … (Albert Einstein)
 
mark.
I'm not a programmer or anything else.
I did not know there would be any problems. I have asked you several times to drop the initial request as well as set it up.
Norwegians only extend the code vba, the file I have attached to you, to an entire column.
Even if this is not possible then it does nothing.
I have made other requests here, it seems that even for those there is an answer.
 
« Norwegians » WTF ?‼

stephano,
first you never asked to drop anything !
And what I ask for is so simple than any 10 years old child
can read post #13 and answer !

Any thread well explained may have an answer …
If you are not able to well do it neither to answer to an easy question
where a child can, just ask to the people who can
to create an account and a thread on any forum !

Some call me The Doctor but as I'm on duty if you do not want
to make any simple effort may I call a Dalek for you ?
 
Hi Mark.
You can replace the post 1 file with this one.
In column d I have inserted a formula that establishes the top level links.
Is it clear to you now?
good day
 

Attachments

  • url.xlsx
    9 KB · Views: 13
New column, new errors or differents URL !

So even forgetting this new column C,
attachment as wrong as first one for row #14 :
result still not matches rules from initial post,
so explain how can it be a redirection ?!

You can't pass an exam with this kind of result !
If I have to evaluate a junior with this result,
I won't take him in any developer or network team !

Again I can never reach this result using fast request way
without any logic explaining clearly this "redirection" !

Could achieve with slowest way piloting IE but
may also return some false result for other good URL …
 
In previous postings you have criticized the fact that column "c" of the post start contains url other than the right redirects. I explained that for columns "a" url I will find the way to include them all with the protocols and that even if url redirects go beyond the first level domain I use column "D" to extrapolate the domains Of the first level.
I can not understand why you ask me how to get a url redirect, if I told you that I, as you have been told by others, get it by entering the links in the column "a" in the address bar ...
 
I just asked you to check result of row #14
and I yet wrote it's not a protocol concern !

Result is Ok for row #13 where domain is the same
between worksheet and webbrowser,
but in exactly same case for row #14 result is redirection
Which not matches your own rules within initial post !

As the domain not changes after validation within any webbrowser
and any protocol, what is your "logic" when you wrote it's a "redirection" ?!
As yet explained in post #20 …

Just read and apply post #13 !
As per results from Narayan in post #16 and Shahin in post #26 …

It's like you asked a code for this :

Illogic.jpg

Irrelevant, isn't it ?!

No Logic, no coding !
Spock-36529.gif

 
Hello.
Now I understand what you mean ...
Indeed, line 14 does not have a redirection because the domain does not change.
I thought it was a matter of protocol and also the fact that the url comprehensively includes domains of other levels.
Then you have been clearer now ...
 
I was obviously crystal clear with « check result » since post #2 (8 days ‼ :rolleyes:)
and with post #7 « it can't be a redirection »
with your result column in your attachment !

The reason why result accuracy is necessary when posting rules …

The more initial post is well explained with a good attachment,
the more chances to have a quicker solution !

When I'll have 10 minutes free I will code this checking at beginner level
(for those who have a couple of neurons just reading request document)
according to post #11 and initial attachment using exactly
the same way as can be found in many samples on web …

Future not belongs to those awaking up early but to those who read !
 
As a demonstration starter, directions to follow :
• open initial attachment (so the one from post #1)
then on VBE side
• activate Microsoft WinHTTP Services reference
• paste this code in the worksheet module of initial attachment :​
Code:
Sub DemoReq()
        Dim R&, S$, U$
    With New WinHttpRequest
            On Error Resume Next
        For R = 2 To Me.UsedRange.Rows.Count
            U = IIf(Cells(R, 1).Value Like "http*", "", "http://") & Cells(R, 1).Value & IIf(Right(Cells(R, 1).Value, 1) = "/", "", "/")
            .Open "GET", U, False
             Err.Clear
            .Send
            If Err.Number Then
                Cells(R, 2).Resize(, 2).Value = [{"no",""}]
            Else
                S = Left$(.Option(WinHttpRequestOption_URL), InStr(9, .Option(WinHttpRequestOption_URL), "/"))
                Cells(R, 2).Resize(, 2).Value = IIf(S = U, [{"ok",""}], Array("redir", S))
            End If
        Next
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Future not belongs to those awaking up early but to those who read !
Hi, Marc L!
I always read the Carlsberg's bottle labels... now thanks to your clarification I will be able to do it from bed late in the morning!!! :DD
Regards!
 
As a demonstration starter, directions to follow :
• open initial attachment (so the one from post #1)
then on VBE side
• activate Microsoft WinHTTP Services reference
• paste this code in the worksheet module of initial attachment :​
Code:
Sub DemoReq()
        Dim R&, S$, U$
    With New WinHttpRequest
            On Error Resume Next
        For R = 2 To Me.UsedRange.Rows.Count
            U = IIf(Cells(R, 1).Value Like "http*", "", "http://") & Cells(R, 1).Value & IIf(Right(Cells(R, 1).Value, 1) = "/", "", "/")
            .Open "GET", U, False
             Err.Clear
            .Send
            If Err.Number Then
                Cells(R, 2).Resize(, 2).Value = [{"no",""}]
            Else
                S = Left$(.Option(WinHttpRequestOption_URL), InStr(9, .Option(WinHttpRequestOption_URL), "/"))
                Cells(R, 2).Resize(, 2).Value = IIf(S = U, [{"ok",""}], Array("redir", S))
            End If
        Next
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !


Hello.
I tried to do as you say, probably for the version I use on this pc something nn go ...
what do you think about it? I attach your photos ..
 

Attachments

  • 1.JPG
    1.JPG
    52.1 KB · Views: 9
  • 2.JPG
    2.JPG
    68.1 KB · Views: 9
  • 3.JPG
    3.JPG
    62.4 KB · Views: 9

As the code rocks on my side whatever Excel or Windows versions,
it seems a direction was not followed but I'm very not surprised …

Where did you exactly paste the code in the project ?!
 
In the first file of my post. In the macro module that opens when I click alt alt f11. As you said.
Maybe it's best if you attach the file to the macro.
 

As written it is not in the "macro" module but in …
Just read again the direction !
Or replace the "error" by the worksheet reference …
 
Hello.

worksheet module do not is the space where the code is entered, which opens by clicking alt alt f11? What a difference between worksheet module and macro module?

Then I saw that you wrote vbe and did not vba, what is the difference?

You're dealing with one who does not know the macros at all :)
 
Last edited by a moderator:
Alt F11 calls VB environment …

As there are differents types of modules !
Standard / general modules, UserForm modules, class modules
and special class modules for workbook (ThisWorkbook) and
for worksheets as you can read everywhere !
So in the Projects window just open the module of the worksheet …
 
Back
Top