Based on a specific domain (from user input), such as company.com, http://company.com, or https://company.com, how can I find out whether the real address for company.com is https://company.com or http://company.com?
Asked
Active
Viewed 653 times
0
-
6You have way too much rep to be asking low quality questions like this – John Conde May 09 '15 at 18:16
-
3Hmm, this looks different to the "duplicate". It looks like he's asking if there's a way to tell if a remote site is using SSL. This is actually a pretty good question - just looks like you interpreted it wrong @JohnConde. – Seer May 09 '15 at 18:21
-
@Seer That duplicate shows lots of ways of determining if the protocol is present or not and if it is https or not. It doesn't take much tweaking of many of the answers to do what they need. – John Conde May 09 '15 at 18:22
-
Actually all other questions I found are about the questioner's own protocol but I am curious about the protocol of any url. – erdomester May 09 '15 at 18:24
-
1@JohnConde I looked. All of the answers there are related to finding out if the script running was queried using HTTPS, **not** if another website is using SSL - which seems to be what *this* question is asking. All of the answers in that thread are not very helpful in this case - it's quite a different situation. Please look at the documentation regarding `$_SERVER` here: http://php.net/manual/en/reserved.variables.server.php – Seer May 09 '15 at 18:24
-
@erdomester That is what I thought you meant. John, can we get this unmarked as a duplicate. This is not one. – Seer May 09 '15 at 18:25
-
1@Seer thanks for representing the defence in the "court" :) – erdomester May 09 '15 at 18:27
-
@erdomester No problem. You may need to ask a new question, and just make sure in the question you explain the issue very clearly, and perhaps even reference the question that this is marked as a duplicate of and explain why it is not one. Maybe see what John says first. – Seer May 09 '15 at 18:29
-
I made a fairly substantial edit to convey what it seems like was being asked. Feel free to roll it back (and sorry) if I was off the mark... – Reed May 09 '15 at 18:33
-
A domain can have both http and https, or just ftp or gopher, or none at all. Also, it may need www as a subdomain to work. If a user is asked to enter a url, and they don't specify a protocol, I would assume they mean `http`. But to check, you might perform a cUrl request to the plain url with `http` in front of it and check whether it redirects to an `https` version. See also: [PHP: Check if URL redirects](http://stackoverflow.com/questions/2964834/php-check-if-url-redirects). – GolezTrol May 09 '15 at 19:42