Jump to content


Photo

Check if a mailserver is blacklisted


  • Please log in to reply
12 replies to this topic

#1 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 04:46 PM

Hi!

I have a problem with a script that i'm creating to se if a mailserver is blacklisted.

<?php
   $file = file_get_contents("http://www.mail-abuse.com/cgi-bin/lookup?ip_address=81.228.8.29");
   print_r($file);
?>

I get this message

Warning: file_get_contents(http://www.mail-abus...ess=81.228.8.29) [function.file-get-contents]: failed to open stream: HTTP request failed! in /www/bl/index.php on line 2


Have I done something wrong or can't I solve my problem like this?

Thanks!

// Johan

#2 Oldiesmann

Oldiesmann
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationCincinnati, Ohio

Posted 14 July 2006 - 04:55 PM

"HTTP request failed" most likely means it couldn't load the website. Besides - file_get_contents loads the contents into a string, not an array, so print_r wouldn't work (either use echo or print).

What problem are you trying to solve here? It doesn't take that long to look that info up.
The Oldiesmann
SMF Project Manager
SMF+Gallery2 - Beta3.1 now available

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 July 2006 - 04:58 PM

I just tried that URL in my web browser and it took awhile to return. It could be a timing issue with PHP timing out while waiting for a response.

Ken

#4 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 05:00 PM

Thats possible...

Is there any other way to solve this?

What problem are you trying to solve here? It doesn't take that long to look that info up.

what do you mean?

I wan't to se if a mailserver is blacklisted at mail-abuse.com

#5 Oldiesmann

Oldiesmann
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationCincinnati, Ohio

Posted 14 July 2006 - 05:04 PM

I understand what you want to do, but don't understand why you need a PHP script to do that. It doesn't take that long to look up an IP address on that site.
The Oldiesmann
SMF Project Manager
SMF+Gallery2 - Beta3.1 now available

#6 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 05:07 PM

Ok. I have a site that look up info about a domain.

It checks dns (MX, NS, CNAME) and so on and I wanted a function that checks mailservers in that list.

#7 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 July 2006 - 05:07 PM

Put a
<?php set_time_limit(0); ?>
at the top of your script. This will prevent your script from timing out after 30 seconds.

It worked for me.

BTW, the print_r function works fine with non-array variables.

Ken

#8 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 05:09 PM

Put a

<?php set_time_limit(0); ?>
at the top of your script. This will prevent your script from timing out after 30 seconds.

It worked for me.

Dosen't work. My PHP runs in safe-mode!

#9 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 July 2006 - 05:11 PM

Find another host, one that trusts their users more.

Ken

#10 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 05:17 PM

Hehe.... just registerd a new webhotell for a year...

But did the script work for you when you add the time out function?

#11 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 July 2006 - 05:20 PM

With the time limit set to 0 (infinate) the script worked fine.

Ken

#12 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 05:22 PM

Ok. Thanks alot for the help!

#13 Re-JeeP

Re-JeeP
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 14 July 2006 - 09:01 PM

With the time limit set to 0 (infinate) the script worked fine.

Ken

Hi again!

I tried the script at home but did'nt get it to work all the time.

I clocked it and if it timed out it stopped at about 75 sec.

Same error mess...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users