Can someone help me to convert the following perl code into php? Leave the Net::DNS, Net::DNS::Resolver, search functions as is. I can replace them with PEAR Net_DNS module. -
use Net::DNS;
-
sub ablookup {
-
my ($domain) = @_;
-
my ($res, $query, @r);
-
-
$res = new Net::DNS::Resolver;
-
while(1) {
-
$query = $res->search("$domain.contacts.abuse.net", "TXT");
-
if ($query) {
-
my $rr;
-
-
foreach $rr ($query->answer) {
-
push @r, $rr->txtdata if $rr->type eq "TXT";
-
}
-
return @r;
-
} else { # Net::DNS rejects special characters, strip off
-
# subdomains and see if a parent domain works
-
if($domain =~ m{^[^.]+\.([^.]+\..+)}) {
-
$domain = $1;
-
} else {
-
die "Cannot lookup contacts for $domain";
-
}
-
}
-
}
-
}
-
Thanks,
5 1432
You do realize that you are asking a Perl forum to help you to convert you Perl script to PHP, don't you? I know I do not know PHP so anything I produced wouldn't work for you as it would be in Perl!
My suggestion is that next time, you please post this question to the PHP forum, where I will now move it to.
Also, then next time you post code in the forums, please place the necessary and proper code tags around the code. This time I will take care of it for you.
Regards, Moderator
Unfortunately i have experience in perl, so im of no assistance!
Goood luck tho :)
Neither am I, and although some code looks familiar, it might help if you tell us exactly what each line does, then we could give it a fair crack. Do you know php?
My level of php is @ beginer. So... I got the code from abuse.net.
If some help me be crack the following line, I may be able to convert the function into php.
if($domain =~ m{^[^.]+\.([^.]+\..+)})
Thanks
My level of php is @ beginer. So... I got the code from abuse.net.
If some help me be crack the following line, I may be able to convert the function into php.
if($domain =~ m{^[^.]+\.([^.]+\..+)})
Thanks
What is that line trying to do?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below....
|
by: Logan X via .NET 247 |
last post by:
It's official....Convert blows.
I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
|
by: Eric Lilja |
last post by:
Hello, I've made a templated class Option (a child of the abstract base
class OptionBase) that stores an option name (in the form someoption=) and
the value belonging to that option. The value is...
|
by: whatluo |
last post by:
Hi, all
I'm now working on a program which will convert dec number to
hex and oct and bin respectively, I've checked the clc but with no
luck, so can anybody give me a hit how to make this done...
|
by: Convert TextBox.Text to Int32 Problem |
last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
|
by: patang |
last post by:
I want to convert amount to words. Is there any funciton available?
Example:
$230.30
Two Hundred Thirty Dollars and 30/100
|
by: Edwin Knoppert |
last post by:
In my code i use the text from a textbox and convert it to a double value.
I was using Convert.ToDouble() but i'm used to convert comma to dot.
This way i can assure the text is correct.
However...
|
by: johnlim20088 |
last post by:
Hi,
Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
|
by: Ken Fine |
last post by:
This is a basic question. What is the difference between casting and using
the Convert.ToXXX methods, from the standpoint of the compiler, in terms of
performance, and in other ways? e.g.
...
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |