С помощью PHP я хочу получить содержимое строки, начинающейся с descr:
, из записи whois из диапазонов IP-адресов RIPE, поэтому все они должны выглядеть примерно так:
% This is RIPE NCC's Routing Information Service
% whois gateway to collected BGP Routing Tables
% IPv4 or IPv6 address to origin prefix match
%
% For more information visit http://www.ripe.net/ris/riswhois.html
route: 53.0.0.0/8
origin: AS31399
descr: DAIMLER-AS Daimler Autonomous System
lastupd-frst: 2011-12-08 23:18Z 195.66.224.97@rrc01
lastupd-last: 2012-01-25 15:18Z 203.119.76.3@rrc00
seen-at: rrc00,rrc01,rrc03,rrc04,rrc05,rrc07,rrc10,rrc11,rrc12,rrc13,rrc14,rrc15,rrc16
num-rispeers: 98
source: RISWHOIS
Так что ядолжен получить DAIMLER-AS Daimler Autonomous System
в результате.
Как это сделать с минимумом кода, у меня есть запись в $ whois.
<?php
$whois = shell_exec('whois -h riswhois.ripe.net ' . $ip);
?>