Página 1 de 1

Funcion UrlShorter traduccion Delphi

Publicado: 06 Ago 2015, 06:02
por crack81
Viendo el post de Doddy deci traducir esta funcion http://indetectables.net/viewtopic.php?f=100&t=53754
les dejo la funcion y un ejemplo
uses
  SysUtils,idhttp;

function getShortUrl(const url: string): string;
var
http:TIdHTTP;
begin
  http:=TIdHTTP.Create(nil); //creamos el objeto
  try
   Result:=http.Get('http://tinyurl.com/api-create.php?url='+url); //retornamos la url
  finally
   http.Free;//liberamos el objeto
  end;
end;


//ejemplo de uso
var //declaramos variables
url:string;
urlCorta:string;
begin
  url:='https://www.google.com.mx'; //url original
  urlCorta:=getShortUrl(url); //obtenemos la url corta
  writeln('La url es: ',urlCorta);//la mostramos por pantalla
  Readln;
end.

Re: Funcion UrlShorter traduccion Delphi

Publicado: 07 Ago 2015, 11:54
por joselin
exelente crack.