How to get long url from short url

I would like to determine how long the short url is. I tried using HTTP HEAD requests, but very few of the returned header fields actually contain any data related to the destination / long URL.

Is there: 1. Any way to define a long URL? 2. If yes, can this be done without loading the body of the addressee?

thank

+3
source share
3 answers

Make HEADand find the title Location.

% telnet bit.ly 80
Trying 168.143.173.13...
Connected to bit.ly.
Escape character is '^]'.
HEAD /cwz5Jd HTTP/1.1
Host: bit.ly

HTTP/1.1 301 Moved
Server: nginx/0.7.42
Date: Fri, 12 Mar 2010 18:37:46 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: _bit=4b9a89fa-002bd-030af-baa08fa8;domain=.bit.ly;expires=Wed Sep  8 14:37:46 2010;path=/; HttpOnly
Location: http://www.engadget.com/2010/03/12/motorola-milestone-with-android-2-1-hitting-bulgaria-by-march-20/?utm_source=twitterfeed&utm_medium=twitter
MIME-Version: 1.0
Content-Length: 404
+5
source

HTTP GET, , Location. , .

, Cocoa , didReceiveResponse . . URL- , [cancel] .

EDIT: , HEAD GET . , , GET.

+6

LongUrlPlease API, URL-.

+3

Source: https://habr.com/ru/post/1736705/


All Articles