Extraer solo una parte de una web
![Nota Nota](https://perlenespanol.com/foro/styles/prosilver/imageset/icon_post_target.gif)
Hi!
Ando tratando de hacer un whois con un servicio web pero ya solo me falta que extraiga lo que yo quiero.
El code quedó así:
Pero me extrae cualquier cosa y yo solo quiero que extraiga esto:
¿Alguien me podría decir cómo modifico mi consulta para que quede así?
Ando tratando de hacer un whois con un servicio web pero ya solo me falta que extraiga lo que yo quiero.
El code quedó así:
Using perl Syntax Highlighting
use LWP::UserAgent;
use HTTP::Request::Common;
$url = "http://www.who.is/whois-ip/ip-address/200.80.1.16/";
$lwp = LWP::UserAgent->new();
$lwp -> agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4");
$request = $lwp ->get($url);
if ($request->content =~ /<br>OrgName:  (.*)<br>OrgTechEmail:  /){
print "\n\n";
print "Funciono guasonsito\n";
print $1;
print "Good bye\n";
exit 1;
} else {
print "EHHHHHHHHH\n";
my $content = $request->content();
print $content;
}
use HTTP::Request::Common;
$url = "http://www.who.is/whois-ip/ip-address/200.80.1.16/";
$lwp = LWP::UserAgent->new();
$lwp -> agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4");
$request = $lwp ->get($url);
if ($request->content =~ /<br>OrgName:  (.*)<br>OrgTechEmail:  /){
print "\n\n";
print "Funciono guasonsito\n";
print $1;
print "Good bye\n";
exit 1;
} else {
print "EHHHHHHHHH\n";
my $content = $request->content();
print $content;
}
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4
Pero me extrae cualquier cosa y yo solo quiero que extraiga esto:
- Código: Seleccionar todo
OrgName: Latin American and Caribbean IP address Regional Registry
OrgID: LACNIC
Address: Rambla Republica de Mexico 6125
City: Montevideo
StateProv:
PostalCode: 11400
Country: UY
ReferralServer: whois://whois.lacnic.net
NetRange: 200.0.0.0 - 200.255.255.255
CIDR: 200.0.0.0/8
NetName: LACNIC-200
NetHandle: NET-200-0-0-0-1
Parent:
NetType: Allocated to LACNIC
NameServer: NS.LACNIC.NET
NameServer: NS2.LACNIC.NET
NameServer: NS-SEC.RIPE.NET
NameServer: NS2.DNS.BR
NameServer: NS3.AFRINIC.NET
NameServer: SEC3.APNIC.NET
NameServer: TINNIE.ARIN.NET
Comment: This IP address range is under LACNIC responsibility for further
Comment: allocations to users in LACNIC region.
Comment: Please see http://www.lacnic.net/ for further details, or check the
Comment: WHOIS server located at http://whois.lacnic.net
RegDate: 2002-07-27
Updated: 2009-04-29
OrgTechHandle: LACNIC-ARIN
OrgTechName: LACNIC Whois Info
OrgTechPhone:
OrgTechEmail:
# ARIN WHOIS database, last updated 2009-06-08 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.
¿Alguien me podría decir cómo modifico mi consulta para que quede así?