How Get the absolete URL from a relative url placed into a input form?

Dear all,

Could I get the absolute url from a relative url placed into an input form?


Input text = ""
absolute url =

Input text = ""
absolute url =

Input text = ""
absolute url =

There are dozens of solutions to get absolute url from a relative url on address bar (the url of the open page), but not from an input form.

I just make a question ultimately!

Could someone help me to find a solution for this case

lebron letchevAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Commented:
Just assume it's "http://", since that should work regardless. If you want to be fancy about it, you could use cURL to see if a request gets redirected to "https://".

I'm curious, did you intentionally mark this as both ASP and PHP? Are you really using both for the same site?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
There's no way to do this with 100% accuracy. You cannot assume "http://" nor "https://" because not all sites will support either or both. Some sites might be "http://" and some others might be "https://" and some might work with both.

From a purely technical perspective, "http://" is currently a required step in the HTTPS handshake, but some sites might try to automatically redirect you to "https://" and others might try to block non-handshake HTTP requests.

If it's critical to find out whether it's "http" or "https", then I'd suggest doing a variation on what David suggested. Instead of hitting "http" to see if it redirects to "https", just hit "https" first (and make sure you do NOT disable verify peer). If it succeeds, then you know the site is very likely accessible via HTTPS. If it doesn't work, then you can assume regular HTTP.

Whatever you do, make sure you put some limitations on it. Otherwise, if you immediately try to connect to a URL that is provided by the user, then you are susceptible to malicious users. Someone could automatically submit the form 1000 times to hit a URL that they are trying to bring down with a denial-of-service attack, so you want to make sure your server is not vulnerable to that.
adding asp and php topics, you finally answered me in your previous question
you just need to read the header using server code and see if you get a http 301 redirect code (maybe you to handle 302) and check if the new location start by "https" with the same address
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

lebron letchevAuthor Commented:

I have a problem in programming! Formerly the languages had little more than 100 commands and functions, in the old days of the turbo pascal, but, today they are thousands and I do not know how to DECORATE ALL !!!

I am working with with 2 files. The first one with a input form and the 2nd in asp classic with Server.CreateObject ("Microsoft.XMLHTTP") and the script of the .asp file does not accept another url that the absolute url. For example:

the absolute url gives an error: msxml3.dll error '80070005'

It accepsts only the absolute ands correct url

And does not redirect the 'wrong' url to correct and current url

Yes, the asp classic and PhP have more options to answer this question, but I need reading and try the available codes to see if I could "rewrite" them

PS: Unfortunately due this 'problem" I could not to do the academic course I love because it have the logic program discipline!!!
Thank you in advance
lebron letchevAuthor Commented:
Dear David S.

In another case I have 1 file in .asp and another in .php. Yes. "they working fine".

This script may be useful: LINK TO CONCURRENT SITE REMOVED

I will search for more to see if I find a code more simple and easy to rewrite it.

thanks by now
lebron letchevAuthor Commented:
Hello, If  I sign up yours solve my question (and other) with a reasonale answer?
lebron letchevAuthor Commented:
Many thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.