From: Dominik 'R. M. <do...@gr...> - 2006-02-27 01:46:14
Attachments:
phpwhois-php5.patch
|
Hello, everyone. I'm writing a DNSBL management system that'll make extensive use of phpwhois. I'm adding a handler for .pl domains (will send later) and the format is so atypical that I've written my own parser instead of using any of those found in whois.parser.php. Basically it has some blocks, but data within the blocks is RPSL-style except for nserver list and registrar's data. While doing that, I've encountered a bug that caused the nserver array to always contain only the last nameserver and only as a ["" => hostname] pair. It took me over half an hour to figure this one out. Patch attached. -- The Fremen were supreme in that quality the ancients called "spannungsbogen" -- which is the self-imposed delay between desire for a thing and the act of reaching out to grasp that thing. -- from "The Wisdom of Muad'Dib" by the Princess Irulan |
From: David S. P. <da...@ol...> - 2006-02-27 07:20:24
|
Hi !! > I'm writing a DNSBL management system that'll make extensive use of > phpwhois. I'm adding a handler for .pl domains (will send later) and the > format is so atypical that I've written my own parser instead of using any > of those found in whois.parser.php. Basically it has some blocks, but data > within the blocks is RPSL-style except for nserver list and registrar's > data. > > While doing that, I've encountered a bug that caused the nserver > array to always contain only the last nameserver and only as > a ["" => hostname] pair. > > It took me over half an hour to figure this one out. Patch attached. Thanx for the patch, i will add it to next release. Nevertheles i have to point that there is no need to write your own parser for .pl domains as that kind of output could be easely parsed by the current parser routines (you could use get_blocks to get the blocks and then generic_parser_b to get the data for each block) -- Thanx & best regards ... ---------------------------------------------------------------- David Saez Padros http://www.ols.es On-Line Services 2000 S.L. e-mail da...@ol... Pintor Vayreda 1 telf +34 902 50 29 75 08184 Palau-Solita i Plegamans movil +34 670 35 27 53 ---------------------------------------------------------------- |
From: Dominik 'R. M. <do...@gr...> - 2006-02-27 11:39:46
|
On Monday, 27 February 2006 at 08:17, David Saez Padros wrote: > Hi !! > > >I'm writing a DNSBL management system that'll make extensive use of > >phpwhois. I'm adding a handler for .pl domains (will send later) and the > >format is so atypical that I've written my own parser instead of using any > >of those found in whois.parser.php. Basically it has some blocks, but data > >within the blocks is RPSL-style except for nserver list and registrar's > >data. > > > >While doing that, I've encountered a bug that caused the nserver > >array to always contain only the last nameserver and only as > >a ["" => hostname] pair. > > > >It took me over half an hour to figure this one out. Patch attached. > > Thanx for the patch, i will add it to next release. You're welcome. Note that I didn't actually test it on PHP4, but it shouldn't break anything, either. > Nevertheles i have to point that there is no need to write your own > parser for .pl domains as that kind of output could be easely parsed by > the current parser routines (you could use get_blocks to get the blocks > and then generic_parser_b to get the data for each block) I'd appreciate some help here, because much as I try to understand the code, it seems overly cryptic, which combined with the complete lack of documentation leaves me wanting to write my own parser from scratch. Also, I think a handler for (some?) .edu domains is missing, try mit.edu for example. Regards, R. -- The Fremen were supreme in that quality the ancients called "spannungsbogen" -- which is the self-imposed delay between desire for a thing and the act of reaching out to grasp that thing. -- from "The Wisdom of Muad'Dib" by the Princess Irulan |
From: Dominik 'R. M. <do...@gr...> - 2006-03-01 14:20:38
|
On Monday, 27 February 2006 at 13:07, David Saez Padros wrote: > Hi !! > > >You're welcome. Note that I didn't actually test it on PHP4, but it > >shouldn't break anything, either. > > it works on php4 Great. > >>Nevertheles i have to point that there is no need to write your own > >>parser for .pl domains as that kind of output could be easely parsed by > >>the current parser routines (you could use get_blocks to get the blocks > >>and then generic_parser_b to get the data for each block) > > > >I'd appreciate some help here, because much as I try to understand the > >code, it seems overly cryptic, which combined with the complete lack of > >documentation leaves me wanting to write my own parser from scratch. > > just take a look at any parser that uses that functions and avoid > looking at the functions code itself, it will show you how to use that > functions (handlers using that functions, almost all, are quite simple > to understand) Yes, the handlers are easy to understand, but my trying to use those functions in a similar way doesn't yield good results. Here's sample output for one of the domains I use, i.e. pekin.waw.pl. ---cut--- % This is the NASK WHOIS Server. % This server provides information only for PL domains. % For more info please see http://www.dns.pl/english/whois.html Domain object: domain: pekin.waw.pl registrant's handle: ont_o50889 (INDIVIDUAL) nservers: ns.pekin.waw.pl.[80.55.44.166] fns2.sgh.waw.pl.[193.111.27.194] created: 2005.08.28 last modified: 2005.08.29 registrar: Onet.pl SA ul. Starowislna 48 31-035 Krakow Polska/Poland +48. 12 2600200 bo...@on... option: the domain name has not option Subscribers Contact object: data restricted registrar: Onet.pl SA ul. Starowislna 48 31-035 Krakow Polska/Poland +48. 12 2600200 bo...@on... Technical Contact: company: Name Lastname street: Somestreet 10 city: 00-000 City location: PL handle: ont_t50878 last modified: 2005.08.29 registrar: Onet.pl SA ul. Starowislna 48 31-035 Krakow Polska/Poland +48. 12 2600200 bo...@on... ---cut--- So I tried to use: $items = array( 'domain' => 'Domain object:', 'owner' => 'Subscribers Contact object', 'tech' => 'Technical Contact' ); $r = get_blocks($data_str, $items); $r["owner"] = get_contact($r["owner"]); $r["tech"] = get_contact($r["tech"]); and $r contains nothing. Any clues will be most welcome. Regards, R. -- The Fremen were supreme in that quality the ancients called "spannungsbogen" -- which is the self-imposed delay between desire for a thing and the act of reaching out to grasp that thing. -- from "The Wisdom of Muad'Dib" by the Princess Irulan |
From: David S. P. <da...@ol...> - 2006-03-01 16:30:37
Attachments:
whois.pl.php
|
Hi !! >>just take a look at any parser that uses that functions and avoid >>looking at the functions code itself, it will show you how to use that >>functions (handlers using that functions, almost all, are quite simple >>to understand) > > Yes, the handlers are easy to understand, but my trying to use those > functions in a similar way doesn't yield good results. > > Here's sample output for one of the domains I use, i.e. pekin.waw.pl. you should use $r = get_blocks($data_str['rawdata'], $items); instead of $r = get_blocks($data_str, $items); also you need to parse blocks with generic_parse_b instead of using get_contacts. I have attached a working pl handler, it will left to detect name servers but it's not possible by now, i will try to change something in the parser so nameserver could be correctly detected. -- Best regrads ... ---------------------------------------------------------------- David Saez Padros http://www.ols.es On-Line Services 2000 S.L. e-mail da...@ol... Pintor Vayreda 1 telf +34 902 50 29 75 08184 Palau-Solita i Plegamans movil +34 670 35 27 53 ---------------------------------------------------------------- |
From: Dominik 'R. M. <do...@gr...> - 2006-03-02 17:43:22
Attachments:
whois.pl.php.patch
|
On Wednesday, 01 March 2006 at 17:31, David Saez Padros wrote: > Hi !! > > >>just take a look at any parser that uses that functions and avoid > >>looking at the functions code itself, it will show you how to use that > >>functions (handlers using that functions, almost all, are quite simple > >>to understand) > > > >Yes, the handlers are easy to understand, but my trying to use those > >functions in a similar way doesn't yield good results. > > > >Here's sample output for one of the domains I use, i.e. pekin.waw.pl. > > you should use > > $r = get_blocks($data_str['rawdata'], $items); > > instead of > > $r = get_blocks($data_str, $items); > > also you need to parse blocks with generic_parse_b instead of using > get_contacts. I have attached a working pl handler, it will left to > detect name servers but it's not possible by now, i will try to change > something in the parser so nameserver could be correctly detected. Thank you, it works nicely. Here's my attempt to extract nservers and fix up city into pcode and city (patch attached). Seems to work fine. Regards, R. -- The Fremen were supreme in that quality the ancients called "spannungsbogen" -- which is the self-imposed delay between desire for a thing and the act of reaching out to grasp that thing. -- from "The Wisdom of Muad'Dib" by the Princess Irulan |