•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,193 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,553 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 456 | Replies: 2 | Solved
![]() |
•
•
Join Date: Sep 2007
Posts: 61
Reputation:
Rep Power: 1
Solved Threads: 6
I have been designing a security system to stop bots from spamming my forum. Basically, it will check if there is any isp name detected from the ip address then if there is no detected isp, the submitted post will not be made. I know to detect the ip address, I simply use:
However it will only get the ip numbers. I need a php script which will only get the isp so i can do something along the lines of the following.
The above code is just a sketch of what I think it will look like but I just need to be able to get the isp information in the $isp variable. I have searched and searched all over google and the hotscripts website and still haven't found the answer. Would anybody here be able to provide any links or ways to find the isp without any other info being bundled in the defining of the $isp variable. An example of what the data stored in the $isp variable would look like is:

or

Thanks in advance
$ip=$_SERVER[REMOTE_ADDR];
if($isp='') { } else {
//rest of code
}or
Thanks in advance
Signature note:
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
•
•
Join Date: Apr 2005
Location: New York state
Posts: 442
Reputation:
Rep Power: 5
Solved Threads: 65
What you're looking to get is the hostname, not the IP. http://us.php.net/manual/en/function.gethostbyaddr.php
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
•
•
Join Date: Sep 2007
Posts: 61
Reputation:
Rep Power: 1
Solved Threads: 6
It took a long time looking at the page you have suggested but I found the answer deep within the page ShawnCplus suggested. Below is the script I found deep within the suggested link which works perfectly.
So thanks ShawnCplus as your reply will really help with preventing bots from spamming my forum.
*Solved*
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$fullhost = gethostbyaddr($ip);
$host = preg_replace("/^[^.]+./", "", $fullhost);
echo $host;
?>*Solved*
Signature note:
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
Do not edit the registry just because someone on the forum says so. Do some research on the internet before editing the registry.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Protection Suite with certain characteristics? (Windows Software)
- Linksys 2.4Ghz 802.11g Wireless PCI Adapter Card (PCI and Add-In Cards)
- Cannot find server or DNS Error Explorer & usps.com (Windows NT / 2000 / XP / 2003)
- My computer keeps disconnecting from our broadband network (Networking Hardware Configuration)
Other Threads in the PHP Forum
- Previous Thread: Deleting A file on the FTP via php script
- Next Thread: if file exists


Linear Mode