{"id":1558,"date":"2016-08-26T17:19:00","date_gmt":"2016-08-26T22:19:00","guid":{"rendered":"http:\/\/linuxitos.com\/main\/ver-la-url-web-destino-de-una-url-acortada-utilizando-curl\/"},"modified":"2016-08-26T17:19:00","modified_gmt":"2016-08-26T22:19:00","slug":"ver-la-url-web-destino-de-una-url-acortada-utilizando-curl","status":"publish","type":"post","link":"https:\/\/linuxitos.com\/main\/ver-la-url-web-destino-de-una-url-acortada-utilizando-curl\/","title":{"rendered":"Ver la url web destino de una URL acortada utilizando curl"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-W09JYsTQi0o\/V8C9FQMbJPI\/AAAAAAAADSA\/u-gIbyZh7cwKQdFFbuMuG5EhJBIpYuqTwCLcB\/s1600\/Captura%2Bde%2Bpantalla%2Bde%2B2016-08-26%2B17-04-35.png\" style=\"margin-left: 1em; margin-right: 1em;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"402\" src=\"https:\/\/3.bp.blogspot.com\/-W09JYsTQi0o\/V8C9FQMbJPI\/AAAAAAAADSA\/u-gIbyZh7cwKQdFFbuMuG5EhJBIpYuqTwCLcB\/s640\/Captura%2Bde%2Bpantalla%2Bde%2B2016-08-26%2B17-04-35.png\" width=\"640\" \/><\/a><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Averiguar la web destino de una URL acortada, es algo relativamente necesario, ya que es muy com\u00fan en redes sociales como Twitter y otras. Para ello vamos a utilizar la librer\u00eda cURL (Curl).<\/span><\/div>\n<p><\/p>\n<h2 style=\"text-align: left;\"><span style=\"font-size: large;\">\u00bfQu\u00e9 es cURL?<\/span><\/h2>\n<p><\/p>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Curl es una herramienta de l\u00ednea de comandos y una librer\u00eda que nos permite conectar con servidores, y trabajar con ellos en formato URL. Soporta los protocolos m\u00e1s comunes, como http, https, ftp, etc. Disponible tanto como herramienta de consola, lo cual nos permite ejecutar comandos directamente, o en librer\u00eda, para usar en nuestro c\u00f3digo. Por ejemplo, puede ser usada desde PHP muy f\u00e1cilmente.<\/span><\/div>\n<div style=\"text-align: right;\"><span style=\"font-size: xx-small;\"><span style=\"text-align: justify;\">Fuente:&nbsp;<\/span>https:\/\/linuxgnublog.org\/como-averiguar-la-web-destino-de-una-url-acortada-con-curl\/<\/span><\/div>\n<h2 style=\"text-align: left;\">Instalaci\u00f3n<\/h2>\n<p><span style=\"font-size: large;\">Despu\u00e9s de la informaci\u00f3n, procedemos (en mi caso desde Fedora) a instalar la librer\u00eda cURL desde un terminal con usuario administrador:<\/span><\/p>\n<p><\/p>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #262626; font-family: &quot;Carrois Gothic&quot;, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;\"><\/div>\n<p><\/p>\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; margin: 0px 0px 1.1em; max-width: 100%; orphans: 2; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; text-align: left; text-indent: 0px; vertical-align: baseline; widows: 2; word-wrap: break-word;\"><span style=\"color: white; font-family: Menlo, Monaco, monospace;\"><span style=\"line-height: 15.68px; white-space: pre-wrap;\">$ sudo dnf install curl<\/span><\/span><\/pre>\n<h2 style=\"text-align: left;\">Prueba<\/h2>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Ahora, desde un terminal y con un simple comando, ya podemos conocer la web destino de una URL acortada:<\/span><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #262626; font-family: &quot;Carrois Gothic&quot;, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;\"><\/div>\n<p><\/p>\n<pre style=\"-webkit-text-stroke-width: 0px; background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: white; font-family: Menlo, Monaco, monospace; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; line-height: 15.68px; margin: 0px 0px 1.1em; max-width: 100%; orphans: 2; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px; word-wrap: break-word;\">$ <span style=\"background-color: transparent; text-align: justify;\">curl -sLI http:\/\/url_acortada | grep -i Location<\/span><\/pre>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Con la opci\u00f3n \u201cs\u201d le decimos a curl que sea silencioso, es decir que no imprima el progreso de la \u201cdescarga\u201d, con \u201cL\u201d que siga las redirecciones que reciba y con \u201cI\u201d que no descargue el contenido, solo las cabeceras HTTP, que son todo lo que necesitamos. Por \u00faltimo, usamos grep para quedarnos la l\u00ednea de la cabecera que nos dice cual es el destino de la redirecci\u00f3n.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Como ejemplo, utilic\u00e9 una url que encontr\u00e9 en twitter, y este fue el resultado:<\/span><\/div>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-QBlg4os4xrQ\/V8DAFBdeOJI\/AAAAAAAADSM\/F6VxXfB0OUsPKLlryVX-P0CxR2tUDV4gQCLcB\/s1600\/Captura%2Bde%2Bpantalla%2Bde%2B2016-08-26%2B17-16-25.png\" style=\"margin-left: 1em; margin-right: 1em;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"136\" src=\"https:\/\/3.bp.blogspot.com\/-QBlg4os4xrQ\/V8DAFBdeOJI\/AAAAAAAADSM\/F6VxXfB0OUsPKLlryVX-P0CxR2tUDV4gQCLcB\/s640\/Captura%2Bde%2Bpantalla%2Bde%2B2016-08-26%2B17-16-25.png\" width=\"640\" \/><\/a><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">En lo personal la utilizo para evitarme los redireccionamientos en los que s\u00ed es posible encontrar la URL final, en algunos casos no me ha funcionado.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\">Espero que sea de utilidad.<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-size: large;\"><br \/><\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Averiguar la web destino de una URL acortada, es algo relativamente necesario, ya que es muy com\u00fan en redes sociales como Twitter y otras. Para ello vamos a utilizar la librer\u00eda cURL (Curl). \u00bfQu\u00e9 es cURL? Curl es una herramienta de l\u00ednea de comandos y una librer\u00eda que nos permite conectar con servidores, y trabajar [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[433,432,7,4,431],"tags":[],"class_list":["post-1558","post","type-post","status-publish","format-standard","hentry","category-acortar-url","category-curl","category-fedora","category-linux","category-url"],"_links":{"self":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/comments?post=1558"}],"version-history":[{"count":0,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1558\/revisions"}],"wp:attachment":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media?parent=1558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/categories?post=1558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/tags?post=1558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}