Get IP from website url lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Ericktux · 2021-08-09 03:59 hello friends, how to get the ip of a certain url, for example: of www.google.com i get 172.217.192.104 I do this by "ping" with cmd, but there will be some code that will facilitate this, thanks ---------------------------------------------------------------------- rsz · 2021-08-09 04:59 Hi, yes have a look at the example in the fcl-net package: https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl- net/examples/testdns.pp#L66 The functions you're looking for are ResolveName and HostAddrToStr. ---------------------------------------------------------------------- Ericktux · 2021-08-09 05:14 hello friend, I just tried it and I get an error "netdb" is missing, I solve it and then another error "BaseUnix" is missing ---------------------------------------------------------------------- trev · 2021-08-09 05:57 You need to also add BaseUnix to your Uses clause. ---------------------------------------------------------------------- marcov · 2021-08-09 07:24 Doing it via the resolve unit might be cross unix/windows portable. ---------------------------------------------------------------------- Ericktux · 2021-08-14 06:16 hello friends, this code is working for me at the moment  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, resolve; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    Edit1: TEdit;    Memo1: TMemo;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } function GetHostByName(HostName:String):String;var  host:THostResolver;begin  host := THostResolver.Create(nil);  if host.NameLookup(HostName) then     result := host.AddressAsString   else     result := '';  host.Free;end; procedure TForm1.Button1Click(Sender: TObject);begin   //ShowMessage(GetHostByName('www.google.com'));     Memo1.Lines.Add(GetHostByName(Edit1.Text));end; end.