PHP Classes

DNS.PHP file giving error

Recommend this page to a friend!

      PHP Email validation  >  PHP Email validation package blog  >  How to Correct Email ...  >  All threads  >  DNS.PHP file giving error  >  (Un) Subscribe thread alerts  
Subject:DNS.PHP file giving error
Summary:Error message
Messages:13
Author:David Halliday
Date:2007-08-07 06:27:26
Update:2009-06-04 16:44:06
 
  1 - 10   11 - 13  

  1. DNS.PHP file giving error   Reply   Report abuse  
Picture of David Halliday David Halliday - 2007-08-07 06:27:26
Hi
The class works fine on linix but I need it on my box using windows.

I have downloaded The DNSResolver class and placed the DNS.php and rrcompat.php in the same folder as the email_validation.php and getmxrr.php files.

When I use the test file: "test_email_validation.php" an error appears that states:

"Warning: fread(): Length parameter must be greater than 0 in DNS.php on line 224"

Is there something missing? Should one use the other 3 files that come with the DNSResolver class, namely:
fetchdns.c
makebcc.bat
makegcc.bat

Any help would be greatly appreciated,
Thanks

  2. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of David Halliday David Halliday - 2007-08-09 18:07:32 - In reply to message 1 from David Halliday
Hello
Just thought of putting the question in a different way!

I need to get the "E-mail address validation" class to work on windows xp. Has anyone tried it on windows? If the problem explianed previously is a common one or tere is no real solution to it, could someone please suggest an alternative to php.dns?

Have tried pear NET_DNS module. That is not working either!

Any help would be greatly appreciated,
thanks

  3. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-08-16 22:18:08 - In reply to message 2 from David Halliday
You just need to provide a function that implements the same functionality of PHP GetMXRR() function and assign the e-mail validation getmxrr class variable with the name of your replacement function.

$validator->getmxrr = "MyGetMXRR";

  4. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of David Halliday David Halliday - 2007-08-17 12:17:01 - In reply to message 3 from Manuel Lemos
Thank you very much for your reply.

I've been working on a function that implements "nslookup" instead of ipconfig. Still struggling with it but I think it will work.

OFF-TOPIC REQUEST: Can you recommend an active forum or yahoo group that discusses networking-related issues like the ones involved in this class (or in general)?

Would be grateful if you did!
Best regards

  5. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-08-17 20:34:48 - In reply to message 4 from David Halliday
I don't know. Maybe you can find help in the groups of alt.comp.networking:

groups.google.com/groups/dir?q=alt. ...

  6. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of David Halliday David Halliday - 2007-08-17 22:00:29 - In reply to message 5 from Manuel Lemos
Many thanks!

  7. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of safuk mankur safuk mankur - 2007-09-06 16:37:20 - In reply to message 2 from David Halliday
Did you have any succes.
If yes, can you share your modifications? I am having the same problem.
Thank you!

  8. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of David Halliday David Halliday - 2007-09-08 05:37:58 - In reply to message 7 from safuk mankur
yes, using "nslookup" works with 100% accuracy when yahoo + gmail addresses are validated.

Let me try to tidy up the script a little bit and then I'll post something!

NOTE: I cannot validate hotmail or msn addresses from Windows because they require my machine ip address to pass "reverse dns lookup". This particular service provider, like many others, has not added an mx record for the range of ip addresses it allocates to subscribers! Still trying to find a way round it!

  9. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of safuk mankur safuk mankur - 2007-09-08 11:04:33 - In reply to message 8 from David Halliday
I can hardly wait to make it work. I am not a php guru and your help is much appreciated.

As with MSN and hotmail accounts, perhaps it would be better to use for testing an email@your.isp and it should bypass the reverse dns lookup(I believe).

  10. Re: DNS.PHP file giving error   Reply   Report abuse  
Picture of ck miller ck miller - 2008-11-06 19:20:05 - In reply to message 1 from David Halliday
If you are on Windows try replacing getmxrr.php with this. This code does not need dns.php:

<?php

function GetMXRR( $hostname, &$mxhosts, &$weight ) {
if (!is_array ($mxhosts) ) {
$mxhosts = array ();
}

if (!empty ($hostname) ) {
$output = "";
@exec ('%SYSTEMDIRECTORY%\\nslookup.exe -q=mx '.escapeshellarg($hostname), $output);
$imx=-1;
foreach ($output as $line) {
$imx++;
$parts = "";
if (preg_match ("/^$hostname\tMX preference = ([0-9]+), mail exchanger = (.*)$/", $line, $parts) ) {
$weight[$imx] = $parts[1];
$mxhosts[$imx] = $parts[2];
}
}
return ($imx!=-1);
}
return false;
}

?>

 
  1 - 10   11 - 13